jquery - Not able to stop AJAX request called from setTimout -


i have seen many posts regarding aborting ajax requests using .abort() function such this post, doesn't work me.

i make repeated ajax calls after every 30 seconds using settimout, , there point stop repeating calls occurring based on condition.

am doing wrong or .abort() has been deprecated? i'm using jquery version 1.9.1.

instead of using:

var xhr = null; ajaxofthesort = function (    xhr = $.ajax    (       success : function()       {          /* */           settimeout( ajaxofthesort, 30000 );       }    ); )  if (/* condition */)    xhr.abort(); 

try using setinterval() :

var ointerval = setinterval (     function()     {        if (/* condition */)           clearinterval( ointerval );        else           $.ajax           (              success : function() { /* */ }           );     },     300000 ) 

Comments