javascript - Send HTTP.call Json -
i have problems sending json verified server, response process has been exist. i'm using http.call, have not gotten far results in when functionality. tests postman , works me correctly.
here copy of code:
// client side event click button var jsonstr = json.stringify(jsonobj); meteor.call("json", jsonstr, function(error, result){ if(error){ console.log("error", error); } if(result){ console.log(resul); } }); ///server side json(jsonstr) { var options = { data: jsonstr, headers: { 'content-type': 'application/json' } } try { var url = "https://api.xxxxxxxxx.com/xxxxxxx-api/4.0/xxxxxx.cgi"; var result = http.call('post', url, options ) return result; } catch (err) { console.log(err) } } //i must receive { "code": "success", "error": null, "transactionresponse": { .... .... .... } }
that's answer i'm getting server
"{"code":"error","error":"invalid request format","result":null}"
fixed problem when using var str = json.stringify (jsonobj);
client , passes through meteor.call()
when receives meteor methods on server not arrive correct format solution pass jsonobj client without giving format , received on server if apply json.stringify (jsonobj)
Comments
Post a Comment