php - using AJAX to make loader? status is not returned from DB -


function main() {     if(window.xmlhttprequest)     {         ab=new xmlhttprequest;       }        else     {         ab=new activexobject("microsft.xmlhttp");      }      ab.onreadystatechange=function(){     if(ab.readystate==4 && ab.status==200)     {         document.getelementbyid("progress").innerhtml=ab.responsetext;       }         }     ab.open("get","querygoogle.php");     ab.send();  } function test(id) {     if(window.xmlhttprequest)     {         xmlhttp=new xmlhttprequest;      }        else     {         xmlhttp=new activexobject("microsft.xmlhttp");      }      xmlhttp.onreadystatechange=function(){      if(xmlhttp.readystate==4 && xmlhttp.status==200)     {         document.getelementbyid("testdiv").innerhtml=xmlhttp.responsetext;           //alert(xmlhttp.responsetext);       }         }     xmlhttp.open("get","test.php",0);     xmlhttp.send();  }     function interval() {            main();       setinterval('test(<? echo $_session['id'];?>)','5000');      //test();   }    

in main function call .php inserts data in db , has execution time of 4 min...in test.php using select query status of inserted data. main.php runs fine when run test.php interval of 5 secs..i don't result , keeps on processing.

i not sure talking about, jquery makes life easier:

function main() {     $.post("querygoogle.php", function(result) {         $(#progress).html(result);     }); }  function test(id) {     $.post("test.php?id=" + id, function(result) {         $(#testdiv).html(result);     }); } 

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -