I'm developing an app in PhoneGap+dreamweaver cs5.5, who makes a call to a handler (.ashx) and returns a JSON string. I do the following:
function appReady(){
var ajax = new XMLHttpRequest();
ajax.open("GET","https://xxxx.xxxxx.com/xxxx/xxxx.ashx?method=GetUser&email=xxx@xxxx.com&pwd=123456",false);
ajax.send();
ajax.onreadystatechange=function(){
if(ajax.readyState == 4) {//Request complete !!
if (ajax.status == 200 || ajax.status == 0) { // OK response
alert(ajax.responseText);
document.getElementById('main').innerHTML = ajax.responseText;
}
}
}
}
When I running the app on the iphone emulator, I recover the json string responseText, but this comes empty on android emulator. In iphone the status returned is 200 but in android is 0. if the problem was the coss-domain request, wouldn't work on any platform right?
I don't understand why the example of the wiki: http://wiki.phonegap.com/w/page/42450600/PhoneGap% 20Ajax% 20Sample
works correctly in two platforms and mine only in iphone ...