Interval function in javascript

Jan 25 2020 10:56 PM
When i am using interval function, clearinterval not works properly.
 
EXAMPLE:
 
function pageload()
var url="../webapplication1/default.aspx"; 
var fininterval=intervla(Redirect,1000,url);
 }
 
function Redirect()
{
  if(okclick==true) 
   {
      clearinterval(fininterval);
      location.href= url;
   } 
   
 
when the okclick becomes true then the clearinterval function not clears the interval,
the Redirect function executes n times again. 

Answers (7)