cordova/cordova-windows-phone — Issue #1: Ajax success callback (jQuery)
Author: dryers
Created: 2012-01-27 15:50:01+00:00
State: open

Success callback is not executed on an ajax request even if the server respond with a 200 code when the ajax request is executed from an event handler.

window.addEventListener('load', function () {
document.addEventListener('deviceready',function(){
$.ajax({
url: 'http://www.example.com',
data: {foo: 'bar'},
cache: false,
dataType: 'json',
error: function (jqXHR, textStatus, errorThrown) { console.log("Error:" + textStatus + ", " + errorThrown); },
success: function (data, textStatus, jqXHR) { console.log(data); }
});
}, false);
}, false);

With this code in the index.html file, the success callback will not be executed.

If the $.ajax instruction is not in the event listener callback and is for example in an inline script tag in the index.html file, the success callback will be executed.

The problem can be resolved by changing in the last line of the phonegap-1.3.0.js file the :

})(window,document);

by

})(win,doc);

Can anyone help me fix this issue otherwise ?