In my application i want to send something to the server after some time. I have implemented it using AJAX. But it works for the first time but not doing it recursively. I have used setTimeOut() for doing that.
    var xmlHttp;
    var requestURL = 'http://localhost:1092/ClassicAJAXDemo/UpdateHeartbeat.aspx?name=';
    function show_data(strName)
    {
        if (strName.length > 0)
        {
            var url = requestURL + strName;
            xmlHttp = GetXmlHttpObject(stateChangeHandler);
            xmlHttp_Get(xmlHttp, url);
        }
    }
    function stateChangeHandler()
    {
        if (xmlHttp.readyState == 4)
        {
            var str = xmlHttp.responseText;
            setTimeOut(show_data('Dev'), 10000); // It is not waiting for 10 seconds.
        }
    }
    function xmlHttp_Get(xmlhttp, url)
    {
        xmlhttp.open('GET', url, true);
        xmlhttp.send(null);
    }
    function GetXmlHttpObject(handler)
    {
        return new XMLHttpRequest();
    }
    window.onload = show_data('Dev');
 
     
     
     
    