javascript - Continuous ajax calls makes application crash -
i have html application contains 4 ajax calls runs continously every 2 seconds back. objective read new , fresh data fron db continuously , seamlessly.
function messagesreceived(){ var querystring = "xxxxxxxxx"; $.ajax({ url:querystring, 'content-type':'application/json', method:'get', datatype:'json', cache: false, success:function(data){ displaymessages(data); rendermessagesreceived(); }, complete: function(xhr,status){ settimeout(messagesreceived,2000); }, error: function(xhr,status){ if(xhr.status == 0){ footertext.settext("network disconnected"); }else{ footertext.settext("something went wrong! please reload page!"); } } }); } function loadreadings() { var querystring = "xxxxxxx"; $.ajax({ url: querystring, 'content-type': 'application/json', method: 'get', datatype: 'json', cache: false, success: function(data) { mapreadings(data); plotreadings(); }, complete: function(xhr, status) { settimeout(loadreadings, 2000); }, error: function(xhr, status) { if (xhr.status == 0) { footertext.settext("network disconnected"); } else { footertext.settext("something went wrong! please reload page!"); } } }); } function loadreadings2() { var querystring = "xxxxx"; $.ajax({ url: querystring, 'content-type': 'application/json', method: 'get', datatype: 'json', cache: false, success: function(data) { initiate(data); footertext.settext(""); }, complete: function(xhr, status) { settimeout(loadreadings2, 2000); }, error: function(xhr, status) { if (xhr.status == 0) { footertext.settext("network disconnected"); } else { footertext.settext("something went wrong! please reload page!"); } } }); }
its runs fine first 15/20 mins , crashes. below link screenshot of error.
can please suggest how resolve this. critical issue have been facing past 15 days. googled solution no luck.
appreciate time , help.
thanks.
Comments
Post a Comment