I have a Phonegap app that needs to post data to a remote server. However, when I try to use jQuery’s $.post, it will never go into the callback.
Here is my Javascript:
$(document).ready(function() {
$('form').submit(function() {
console.log('about to post');
$.post('http://mysubdomain.mydomain.com/index.php', function(data) {
console.log('In callback');
console.log(data);
});
});
});
When I run this and look in the Eclipse LogCat, I see “about to post” but I never see “In callback”. I dumped this into a script tag in my PHP file on my server to make sure it is correct and sure enough, when I refresh the page I see the HTML show up in the Javascript console. I already whitelisted all domains in my config.xml file in res/xml, so I don’t understand why this is not working. If anyone has any insight please let me know. Thanks!
I would guess the reason you are never entering the success callback is that some kind of error is happening. Try the same request with something like:
That should at least show you the error…