ajax - How to reuse function for 10 sec. Javascript -


i have function calling json:

function inspect(){      $.ajax({         type: "get",         url: 'addtest.json',         datatype: "json",         async : false,         success: function(response) {             (n=0; n<20; n++){                 var result = (response[n][3])                     if(result == "done"){                          document.getelementbyid('status').innerhtml = "test ok"                          n=20;                     }             }         },          error: function(response) {             alert("no file")         }     }); }  

this working fine. content in file addtest.json not static. it's changing when start test. question is. how make ajax function recall 10sec. if result == "done" stop. if after 10sec trying result != "done" stop alert("not tested")

try using settimeout

settimeout javascript


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -