I am trying to check for the internet connection by sending a GET request to the server. I am a beginner in jquery and javascript. I am not using navigator.onLine
navigator.onLine
you cannot get simple true or false in return, give them a callback handler
function is_internet_connected(callbackhandler) { $.get({ url: "/app/check_connectivity/", success: function(){ callbackhandler(true); }, error: function(){ callbackhandler(false); }, dataType: 'text' }); }