user3719454 user3719454 - 3 months ago 7
Ajax Question

Either 'success' xor 'error' will be called in jQuery's ajax, right?

I have to set a flag inside of

$.ajax()
and I would like to know if I have
success
and
error
so the execution will go into one of these functions all the time. Is that true? So there's no scenario when none of these functions are executed, right?

Answer

So there's no scenario when none of these functions are executed, right?

Assuming JavaScript keeps running on the page at all, you're guaranteed to get the success or error callback. Either way, you're guaranteed to get the complete callback.

Comments