zakir ali 0 Newbie Poster
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 the main() i am insertig data in a table and i am running this function synchronously 2 minutes and from test() i am getting the result, of on which insertion id this is processing every 5 second getting alert(id) but giving me only alert not the id

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.