jeudi 20 novembre 2014

How can I tell the difference between reasons for aborted AJAX operations?

An AJAX operation may be aborted

(1) Because it has timed out


(2) Because the use has navigated away from he page (in the iframe) that initiated the request.


In case (1) obviously we want to show an error message to the user, as something has gone wrong that they need to know about.


In case (2) obviously we don't want to show an error message to the user, as the aborted AJAX call is a direct consequence of the user's decision to move to a different page.


But how can I tell the difference (in Ext JS 4)? In both cases I seem to get a response object with status 0 and statusText being the empty string?


Ext JS 3 code seemed to manage by checking statusText for 'communication failure', but I'm not getting that any more.






How can I tell the difference between reasons for aborted AJAX operations?

Aucun commentaire:

Enregistrer un commentaire