I want to pass  data to my server.

With only post method, I am able to access the data file from the server .
var res = zebra.io.POST("http://test.com");
But, When I want to pass parameters with the URL.
// synchronous HTTP POST call with query parameters var res = zebra.io.POST("http://test.com", { name : "var1", address : "var2", param1 : "var3" });
I do not get any $_POST  parameters.
Can anybody have idea why , I am facing this ?
 
Regards,
Satyam
 
 

1 answer

Staff August 30, 2015

Think zebra sends wrong “content-type” in this case. It should be “application/x-www-form-urlencoded”, but zebra sends “text/plain;charset=UTF-8″. You can try to change it manually. Try to use the code below: 

 var http = new zebra.io.HTTP("test.com");
http.header['Content-Type'] = "application/x-www-form-urlencoded";
http.POST({
a:"10"
});

 

#1
  1. hello Team,Thank you so much for reply.I tried to send the same things but still I am not able to get data into POST method on server side.If you have any working example for this , please share with melogs:JS:LOG Data send to post method a=10JS:LOG IO callback 200JS:LOG return array(0){ }Server side code:<?phpprintf(var_dump($_POST));if(isset($_POST['a']){do something ...}

    ici. get HTTP 204 undefined

Please login or Register to Submit Answer