views:

27

answers:

1

Hi

I am wondering if you do an AJAX request and you have a method that should run when the AJAX request stops. Will the jQuery ajax stop run if the request runs into an error (such as a 500 error) or if say the request times out?

+1  A: 

Yes, the ajaxStop() event will execute when this happens :)

It happens in the global complete handler, which executes error or not.

You can test it out a bit here.

Nick Craver
Nice just wanted to know that not that my jquery loading msg stays on loading and the users can't continue even if the ajax request died along the way.
chobo2
@chobo2 - Ah I see, good question...this has come up a number of times on SO, but never a direct question that I can remember...edited the question a bit to make it a bit more google-friendly for future users :)
Nick Craver