JQuery Ajax - How to Detect Network Connection error when making Ajax call

前端 未结 8 2220
闹比i
闹比i 2020-11-27 04:02

I have some Javascript JQuery code that does an Ajax call to the server every 5 mins, it\'s to keep the server session alive and keep the user logged in. I\'m using $.

8条回答
  •  囚心锁ツ
    2020-11-27 04:44

    You should just add: timeout: , somewhere within $.ajax({}). Also, cache: false, might help in a few scenarios.

    $.ajax is well documented, you should check options there, might find something useful.

    Good luck!

提交回复
热议问题