Access to restricted URI denied code: 1012

Jimmy Chandra picture Jimmy Chandra · Sep 9, 2008 · Viewed 47.6k times · Source

How do you get around this Ajax cross site scripting problem on FireFox 3?

Answer

Glenn Slaven picture Glenn Slaven · Sep 9, 2008

If you're using jQuery it has a callback function to overcome this:

http://docs.jquery.com/Ajax/jQuery.ajax#options

As of jQuery 1.2, you can load JSON data located on another domain if you specify a JSONP callback, which can be done like so: "myurl?callback=?". jQuery automatically replaces the ? with the correct method name to call, calling your specified callback. Or, if you set the dataType to "jsonp" a callback will be automatically added to your Ajax request.

Alternatively you could make your ajax request to a server-side script which does the cross-domain call for you, then passes the data back to your script