I am trying to open and read an XML file from Phonegap but having this CORS error. How can I resolve this?
XMLHttpRequest cannot load file://localhost/../data/file.xml. Origin null is not allowed by Access-Control-Allow-Origin.
The caller code is:
var request = $.ajax({
type: "GET",
url: "data/file.xml",
async: false,
dataType: "xml"
});
I also have this snippet in my code due to the explanation here:
$(document).on( "mobileinit", function() {
$.support.cors = true;
$.mobile.allowCrossDomainPages = true;
});