SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Evangelist
    Join Date
    Jun 2010
    Location
    Israel
    Posts
    523
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    "Please wait" msg during an ajax call

    Hey guys,
    How can i make an "please wait" msg while an ajax request is proccesing?
    My code looks like this:
    Code:
    function showInfo(num)
    {
    	if (window.XMLHttpRequest)
    		xmlhttp=new XMLHttpRequest();
    	xmlhttp.onreadystatechange=function()
    	{
    		if (xmlhttp.readyState==4 && xmlhttp.status==200)
    			document.getElementById("wrapper").innerHTML=xmlhttp.responseText;
    	}
    	// some unessasry code
    	xmlhttp.open("GET","getdogs.php?parameters=xxx,true);
    	xmlhttp.send();
    }
    Thanks,
    ulthane

  2. #2
    SitePoint Evangelist
    Join Date
    Jun 2010
    Location
    Israel
    Posts
    523
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    solved...
    solution:
    Code:
    function showInfo(num)
    {
    	document.getElementById("wait").innerHTML="please wait";
    	if (window.XMLHttpRequest)
    		xmlhttp=new XMLHttpRequest();
    	xmlhttp.onreadystatechange=function()
    	{
    		if (xmlhttp.readyState==4 && xmlhttp.status==200)
    		{
    			document.getElementById("wait").innerHTML="";
    			document.getElementById("wrapper").innerHTML=xmlhttp.responseText;
    		}
    	}
            // some code
    	xmlhttp.open("GET","getdogs.php?parameters=xxx,true);
    	xmlhttp.send();
    }


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •