Closed drblmb closed 7 years ago
@drblmb I didn't find any methods to append the query string in the request body. Instead I defined a method to convert querystring into json. This method doesn't parse properly if the querystring has =,& symbols.
queryStringToJSON = function(str){ var pairs = str.split('&'); var result = {}; pairs.forEach(function (pair) { pair = pair.split('='); var name = pair[0] var value = ""; value = pair[1] if (name.length) if (result[name] !== undefined) { if (!result[name].push) { result[name] = [result[name]]; } result[name].push(value || ''); } else { result[name] = value || ''; } }); return (result); }
I was able to find some code that implemented a cordovaHTTP.postJson method. I forked this project and got it working. https://github.com/serviewcare/cordova-HTTP.
I cannot figure out how to create a POST request where the data is not in JSON. For example, in the body of my POST request I want "termsaccept=true&userid=confusedUser"
Please give me an example of this. Thanks!