I am using Qooxdoo AJAX to POST the following data 

    req = new
qx.io.remote.Request("http://localhost:8080/smartways/vehicle/";, "POST",
'application/json');
      req.setCrossDomain(false);
      req.setRequestHeader("Accept","application/json");
      req.setRequestHeader("content-type","application/json");
      req.setData(
'{"id":2,"type":"Bus","depot":"Indiranagar","simMSISDN":"9959142000","imeiNumber":"I-1234567","gatewayId":"G1","make":"MARUTI","capcity":75,"numberOfDoors":2,"fuelCapacity":100,"fuelEconomy":10,"maxPermittedSpeed":100,"vehicleIdentificatioNumber":"KA-10Z-5428"}');
      

However it seems at backend the media type is set to
application/x-www-form-urlencoded and I am getting a parse error.

The following CURL works fine.


curl -X POST -Hcontent-type:application/json --data
'{"id":1,"type":"Bus","depot":"Domlur","simMSISDN":"9959142000","imeiNumber":"I-1234567","gatewayId":"G1","make":"BMW","capcity":75,"numberOfDoors":2,"fuelCapacity":100,"fuelEconomy":10,"maxPermittedSpeed":100,"vehicleIdentificatioNumber":"KA-10Z-5428"}'
http://localhost:8080/smartways/vehicle/



I am unsure where the error is. What is the right way to post the data ?

Regards
Ram


--
View this message in context: 
http://qooxdoo.678.n2.nabble.com/How-to-Post-JSON-Data-tp7367956p7367956.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to