Jquery – getJSON call working on IE 7 but not Firefox 3

ajaxfirefoxjqueryjsonrest

I have a web application that uses the current version of JQuery that needs to get some JSON objects back from a REST web service. I'm using the following call to $.getJSON:

$.getJSON("http://localhost:17245/Service.svc/?format=json", function(data) {alert(data.id);});

This call works fine in IE7 and I can call the service with no problem in Fiddler. I've stepped through this in Firebug, but when Firefox gets to this line the javascript execution just seems to "die" with no error, no call back, no nothing.

I've also used $.ajax and have the same issue; works fine in IE, nothing in Firefox.

Anyone have any ideas? I'm VERY new to JQuery, so please be gentle.

Thanks,
James

Best Answer

I had a similar issue. The signature $.getJSON is (url, data, callback) and I was not passing the data argument either. Try this:

$.getJSON("http://localhost:17245/Service.svc/?format=json", {}, function(data) {alert(data.id);});