Zebra API Doc

zebra.io.POST()

POST

(
  • url
  • [parameters]
  • [callback]
)

Shortcut method to perform asynchronous or synchronous HTTP POST requests.

   // synchronous HTTP POST call
   var res = zebra.io.POST("http://test.com");

   // asynchronous HTTP POST call
   zebra.io.POST("http://test.com", function(request) {
       // handle result
       if (request.status == 200) {

       }
       else {
           // handle error
           ...
       }
       ...
   });

   // synchronous HTTP POST call with query parameters
   var res = zebra.io.POST("http://test.com", {
       param1 : "var1",
       param1 : "var2",
       param1 : "var3"
   });

   // synchronous HTTP POST call with data
   var res = zebra.io.POST("http://test.com", "data");

   // asynchronous HTTP POST call with data
   zebra.io.POST("http://test.com", "request", function(request) {
       // handle result
       if (request.status == 200) {

       }
       else {
           // handle error
           ...
       }
   });

Parameters:

  • url String

    an URL

  • [parameters] Object optional

    a dictionary of query parameters

  • [callback] Function optional

    a callback function that is called when the GET request is completed. Pass it if to perform request asynchronously