jquery - Why does this Ajax work in IE 7 and 8 but not FF or Chrome? -


say i'm using following ajax call:

$(document).ready(function () {     $.ajax({         type: "get",         url: "http://www.w3schools.com/xml/cd_catalog.xml",  //test xml         datatype: "xml",          success: xmlparser,         error: alert("we can't find xml!"),         asynch: true     }); });  function xmlparser(xml) {      $(xml).find("cd:lt(3)").each(function () {          $("#offers").append('<h1>' + $(this).find("artist").text() + '</h1><p>' + $(this).find("year").text() + '</p>');      }); 

this works fine in ie 7 , 8, doesn't work in ff or chrome. empty xml file , following error in browsers:

xml parsing error: no element found location: moz-nullprincipal:{77f5fd10-d793-4d35-9a4b-b8280b704fba} line number 1, column 1:

when googled error, thought due ajax cross-domain issue. if case, wouldn't disabled in browsers? appreciated - i'm kinda new whole ajax thing.

thanks!

you making ajax call client outside domain (unless you're writing code www.w3schools.com.

this sop (same origin policy) issue. try using jsonp (if server set that), or can move call server (php, c#, etc..) , have server make call on behalf of client.

i suggest googling "sop" , "jsonp".


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -