Building an app using Phonegap and jquery on Android using this code to request xml data:
$.ajax({
url: 'test.xml',
type: 'GET',
success: function(xml) {
//Retrieve user token
var token = $(xml).find('token').text(); // Store token for subsequent requests
alert("Token is " + token);
},
error: function(xhr) {
alert("Error");
xml = xhr.responseXML;
$(xml).find('error').each(function() {
alert($(this).find('message').text());
});
}
});
I’ll ultimately be making a REST request to an api, but checking this way with a static file to try and figure out the issue.
This works fine on a handset using Android 2.3.4 when requesting the file from both a local and remote location. An error occurs when making the remote (ie. cross origin) request on a newer device using Android 3.2.1.
Is this because of a tighter security policy in the more recent browser? If so, and suggestions how I can address this?
Thanks guys.
Look for this solution that i posted earlier, it had worked for me. you can give it a try.
Solution