the following code works on firefox,chrome and IE9 on my PC.
But the callback function doesn’t return when I run it in WP7 device using phonegap.
function downloadXML(
$.ajax({
async: true,
cache: false,
type: 'GET',
dataType: "xml",
crossDomain: true,
url: yql_url('http://some-cross-domain-url'),
error:function(xhr, status, errorThrown){
navigator.notification.alert(errorThrown+'\n'+status+'\n'+xhr.statusText);
},
success: function (xml) {
navigator.notification.alert("successful");
}
});
}
yql_url = function(source_url) {
return "http://query.yahooapis.com/v1/public/yql?q=select * from xml where url=\"" + source_url + "\"";
}
Does anyone point out what EXTRA has to be done to make it run on WP7 ? THX
OR let me re-frame the question,
Can someone give me a code snippet which works on WP7 with phonegap that can fetch XML from a cross domain URL.
I have been trying a lot to make it run on WP7 without any success 🙁
You need to set the following to true:
$.support.cors
and
$.mobile.allowCrossDomainPages
Check the jQuery Mobile Docs