Phonegap Xmlhttprequest Responsetext Empty With Android But Contain Data In Iphone
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 XMLHtt
Solution 1:
Check for cross-domain scripting issues. I did almost the same thing, except my URL was actually located on the same domain. It worked fine on Android and on a PC, but the iphone refused to function. When I changed from 'https://whatever.whatever.com/foo.asp' to just foo.asp - it worked!
var rootpath;
rootpath = "https://the.same.dam.place/foo.asp"; // did not work!
rootpath = "foo.asp"; // shortening it worked.functionread_foo(whatever)
{
var url = rootpath + "?whatever=" + whatever;
xmlHttp = GetXmlHttpObject(stateChanged);
xmlHttp.open("GET", url , true);
xmlHttp.send(null);
}
functionstateChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
var return_place = document.getElementById('return_place');
var thetext = xmlHttp.responseText;
return_place.innerHTML= thetext;
}
}
also see:
Empty responseText from XMLHttpRequest
Post a Comment for "Phonegap Xmlhttprequest Responsetext Empty With Android But Contain Data In Iphone"