getJSON not working in IE

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

getJSON not working in IE

citron
Hi, a strange error orrurs in IE when using getJSON, Chrome and Firefox are working ok.

Any ideas how to solve this error?

Thanks!!


console.log("urlData: "+urlData);

$.getJSON(urlData, null, function( json)
{
// .. do someting
}).error(function(jqXHR, textStatus, errorThrown) {
console.log("error: " + textStatus);
console.log("error throw: " + errorThrown);
console.log("incoming Text: " + jqXHR.responseText);
// .. do someting else
})


------------------------------
gsp resource
<%
response.setHeader ("Cache-Control", "private, max-age=0");
response.setHeader ("Pragma", "no-cache");
response.setHeader ("Expires", "-1");

println AlertUtil.getAlertsInJSONFormat();

%>

------------------------------
Reply | Threaded
Open this post in threaded view
|

Re: getJSON not working in IE

John Moore
It may be completely unrelated, but I just solved an error which was only occurring with IE and not Chrome or Firefox, which turned out to be to do with logging itself. I had some 'console.log' statements among my JS, and IE was choking on them, unless the console was actually open. I switched to using the function below instead (e.g. 'logger("whatever") and the problem was solved:

function logger(s) {
    window.console && window.console.log && console.log(s);
}

I only point this out because I see you were using 'console.log' and wondered whether it might be the same thing.
Reply | Threaded
Open this post in threaded view
|

Re: getJSON not working in IE

citron
Excellent!

Using this function instead of console.log directly solved the problem:

function logger(s) {
    window.console && window.console.log && console.log(s);
}

Thanks a lot for your help John Moore!!