Skip to content Skip to sidebar Skip to footer

Jquery Ajax Success Fired Twice, Because Of .done Callback

I have some legacy code, which aborts ajax requests in a scenario & then after user-response, resends that request. function resendLastAjaxRequest(ajaxRequest, ajaxSettings){

Solution 1:

Like I said in the comments, I think previously you had a jQuery version lower than 1.5 (without .done() implemented) so the success method is invoked as a callback then .done() throw an error in the console without breaking anything (like undefined is not a function). So in this case, you have an error in the console and only one callback function called.

Demo with jQuery 1.4.4 : jsfiddle

In the console :

1 error : undefined is not a function (because of .done())

and

1 log : Object (datas from the call)

Post a Comment for "Jquery Ajax Success Fired Twice, Because Of .done Callback"