Convert Parse Token Curl to Ajax -
i need convert ajax.
curl -x post \ -h "x-parse-application-id: ****************" \ -h "x-parse-rest-api-key: ******************" \ -h "content-type: application/json" \ -d '{ "devicetype": "ios", "devicetoken": "result" , "channels": [ "" ] }' \ https://api.parse.com/1/installations
i found solution create ajax post method. in example, following ajax method.
var headers = { "x-parse-application-id":"your id", "x-parse-rest-api-key":"your rest api key" }; // convert data object json string: var userdata = { "devicetype": "the device or variable says device", "devicetoken": "the token or variable token", "channels": [""] }; var data = json.stringify(userdata); $.ajax({ headers: headers, type: 'post', url: "https://api.parse.com/1/installations", contenttype: "application/json", data: data, datatype:"json", success:function(data) { // log responce server check. alert("data:" + json.stringify(data) + " status: " + status); }, error:function(data) { // show error message: alert("your data didn't save!" + json.stringify(data)); } });
Comments
Post a Comment