Reputation: 97
Below is javascript which is being called in $(document).ready
function. In IE its working fine and returning the records where as in firefox and chrome its giving error. But error not giving any details. It just says ready state = 0, status = error and responseText is blank.
var surl = serviceUrl + trainingService + "GetLastUpdateDate/";
$.ajax({
url: surl,
dataType: 'json',
success: function (data) {
alert("SUCCESS: " + data.d.length);
},
error: function (xhr, textStatus, error) {
alert("readyState: " + xhr.readyState + "\nstatus: " + xhr.status);
alert("responseText: " + xhr.responseText);
}
});
As someone asked in the comments below is the screenshot of firebug debugger, as I mentioned earlier it doesn't give much details.
Upvotes: 2
Views: 8490
Reputation: 2748
I had this issue, its because i was using <button onClick="doSomething()">button</button>
which was causing the page to do a postback instead using <input type="button" onClick="doSomething()" value="button"/>
worked perfectly
Upvotes: 1
Reputation: 62
Is your ajax call a request to the same domain? If not, you should use JSONP instead of JSON.
https://api.jquery.com/jQuery.ajax/
https://learn.jquery.com/ajax/working-with-jsonp/
Also, I have seen where IE will work and Chrome and Firefox will not if the ajax request is not of the same protocol as the requesting page (if the page is https and the ajax call is http for example).
And last, do you have any ad blocking plugins installed on Firefox and Chrome that aren't installed on IE? I've seen where some ad blocking plugins will also block ajax requests.
Upvotes: 0