Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery ajax problem in chrome

Tags:

i have the following jquery code running on my page just fine in FF and IE, but chrome seems to be freaking out..

in FF and IE the call is made and the result is appended to the div. in chrome, it calls ajaxfailed on failure.

the XMLHttpRequest passed to the AjaxFailed function has a status code of "200" and the statusText is "ok". the readystate is 4 and the responseText is set to the data i wish to append to the div.. basically from what i can see its calling the failure method but it isn't failing.. i have tried with both get and post requests and it always breaks in chrome.

function getBranchDetails(contactID, branchID) {   $.ajax({     type: "GET",     url: urlToRequestTo,     data: "{}",     contentType: "application/json; charset=utf-8",     dataType: "json",     success: branchDetailsSuccess,     error: AjaxFailed   }); }     function branchDetailsSuccess(result) {       $("#divBranchControl").empty();       $("#divBranchControl").append(" " + result);       $("#branchDiv").tabs();     }     function AjaxFailed(result) {       alert("FAILED : " + result.status + ' ' + result.statusText);     } 
like image 966
spaceman Avatar asked Nov 16 '09 12:11

spaceman


People also ask

Why is AJAX not working chrome?

In the AJAX operation just add: async: false after datatype: "json" , and that should solve your problem. Chrome has issue handling asynchronous calls. Show activity on this post.

Does Google Chrome support AJAX?

Ajax is supported in all modern browsers. We suggest using the following browsers: Google Chrome. Mozilla Firefox.

What triggers jQuery AJAX fail?

version added: 1.0.Whenever an Ajax request completes with an error, jQuery triggers the ajaxError event. Any and all handlers that have been registered with the . ajaxError() method are executed at this time.


1 Answers

In the AJAX operation just add: async: false after datatype: "json", and that should solve your problem. Chrome has issue handling asynchronous calls.

like image 67
MSS Avatar answered Oct 07 '22 07:10

MSS