Best way to handle session timeout on ajax call
I am testing my mobile website and I noticed that when an ajax call is made it just shows a text message "Error Loading Page". I see that you can override the pageloadfailed method. This seems like the best place to handle it. My question is does anyone have a piece of code for the pageloadfailed that handles the following:
- hide the loading icon.
- check the xhr object to see what type of failure it was. If it was a certain error say 401 then redirect to the login page. If it is any other type of error then use the current mechanism for displaying the error message but with custom text.
Any help would be greatly appreciated.
Thanks,
Marty