Here is my post request:
exports.APIPostRequest = function(url, JSONObj, callback, errorCallback) {
Ti.API.info('Get Request is called');
var req = Titanium.Network.createHTTPClient({
onload : callback,
onerror : errorCallback,
timeout : 60000
});
req.open("POST", url);
req.setRequestHeader('Content-Type', 'application/json');
//JSON object goes into send method.
req.send(JSONObj);
};
after I make my request.
After making a post request , it does not send the JSON object.
{"facebook_token":"dasdaddasd","date_of_birth":"503435231.0","gender":"male","ethnicity":"","description":"ls lsls ","nickname":"ffsfs"}
Now when I post it , the api complains that it is not in the right format:
{
"facdebook_scriptioken":"BAACMVus3xYsdwqdAdkSGzrr0vFscmDK=IuA%20zW4QYlovSziJJCmrpFtyNl8edfR4hVU1ZAv60yHqFP7yEJ8g6SSrmvibt9Grw7L%27xIsALM0mVWsZBTRcYAIPzy%23npG6SKE12sAcno0kWVhg5LZAljqM0ZBzUtsZA8W9zife%21&publiGdWLc_name=0wbjEx4xGU&genwAJiZAder=malwFF9ZBmUe&ev8gGjDgZDZD",
"thnickname":"jsm",
"ity=&date_of_birth": =503435231,
"gender":"male",
"public_name": false,
".0&body_type":"thin",
"devi=&facebook_token": "ad=CAAUYyAuheuQrc0BAKRqYidhw2gFK1GSmniDZddadwoKblpLIVZC1fwTpfhwugRIabmiZBZANfh0ZAV67I9QowuehfiwhfweqonD5IaRZApgWkgfhpODKJ2KGLIdwWt89KyCZBy9UMPmjIbZBGxN64IZCkZAFLMk6KapBHqU4no98MoSZBtqRHguYJnImQ8tV1bEFfSZBqzShaeiw"
"sD9kAfTN2F3xethZAXqTfEob2vqUVk5pXsAqsYZD&nicity":"",
"dknamesc=Pription":"thices is m%dadad"
}
Totally scrambled , why is this happening, cheers?
{
"facebook_t": "Bdadadadsadadadad",
"niame": "jsm",
"publethnic_name": false,
"body_itype": "thAsan",
"devscrice_ptioken": "aduhI loveu my lidhwihwufefwpfhwu!",
"nifhwucknamehf": "Priwhfwncefhwhifwufhss eiw",
"ethnpublicity_name": "0",
"bodescripy_tionype": "Prefer not thiso dis mclose."
}
Do it JSON.Stringify and let me know if still complains the same
xhr.send(JSON.stringify(JSONObj))
Thanks