Phonegap android ajax requests work for GET but not POST

Sending the request below in my Android app for Android apps for GET but not POST. Everything works with GET. With POST, the request passes, but the POST variables do not pass through the server, and the server returns json, which says that "parameters are not specified."

POST works great with our mobile application - it's just a phonegap application in which we have a problem. What am I missing here ??? Thanks in advance for any help you can provide!

I tried changing the settings to calling $ .ajax, the android manifest, all I can think of.

In addition, I use Android 2.2 and Phonegap 1.0.


function goTeam(){ var dataString={lat:currentLocation.lat(),lng:currentLocation.lng()}; // this all works $.ajax({ url: 'http://example.com/request/goTeam', data: dataString, dataType: 'json', success: function(b) { if(b.status==1){ // woo hoo! it works } else { // the request went through but something was wrong - this is what i'm getting with POST } }, type: 'post', // works with GET, doesn't work with POST error: function(jqXHR, textStatus, errorThrown){ alert("Noooo."); } }); 
+4
source share
2 answers

Phonegap works with both GET and POST - cross-domain security issues are not applied. We had an idiosyncratic error in our code that prevented it from working. The telephone connection is pretty amazing!

0
source

Are you trying to complete cross-domain requests? Only GET requests work this way. You can use JSONP for this kind of request, but only GET works.

0
source

All Articles