Using jQuery Ajax to fetch data from local server: it works well with IE8 but with Firefox4 it goes wrong: (entering error function with just “error” message). Firebug shows the data is getting correct.
The running URL is:
http://localhost:47092/testajax
The related jQuery code is:
$.ajax(
{
type: "GET",
url: "http://localhost/test",
processData: true,
data: {},
dataType: "json",
success: function (data, code, jqx) {
console.log(data);
},
error: function (jqx, err, ex) {
console.log(ex);
}
}
);
What can be the cause of the error? I am using jQuery 1.5.2
Also, I am using jQuery.support.cors = true to enable cross domain scripting.
Sounds like you ran into a cross-site-scripting protection.
The protocol, the hostname, and the port has to be identical. Otherwise you have to use a solution like JSONP.