Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

If Internet goes down while we make a Ajax Request then how to give feedback to the user that the internet is down?

Tags:

ajax

If Internet goes down while we make a Ajax Request then how to give feedback to the user that the internet is down ?

like image 812
koka Avatar asked Nov 05 '22 06:11

koka


1 Answers

You can define a timeout on AJAX request, if timeout is reached you can then choose best way to display the error message to the user.

BTW, you cannot be certain that internet connection is down, so a standard message could be:

Unable to contact server at url: 'http://myapp.com'.
Please be sure your internet connection is working

like image 173
Alois Cochard Avatar answered Nov 09 '22 11:11

Alois Cochard