Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Senior Coder BarrMan's Avatar
    Join Date
    Feb 2005
    Location
    Israel.
    Posts
    1,644
    Thanks
    69
    Thanked 83 Times in 82 Posts

    Loading message doesn't work

    Hey. I'm trying to create an AJAX page but the loading message doesn't show.
    The AJAX data shows up fine.
    This is my code:
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <script type="text/javascript" src="getXml.js"></script>
    <head>
        <title>Untitled Page</title>
        <style type="text/css">
            #update{
                float: right;
                overflow: auto;
                width: 400px;
                height: 500px;
                border: 1px solid black;
            }
        </style>
        <script type="text/javascript">
            function refresh(dir)
            {
                var myvar = getXml();
                myvar.onreadystatechange = function()
                {
                    var myobj = document.getElementById("update");
                    if(myvar.readyState ==1)
                        myobj.innerHTML = "Loading content...";
                    if(myvar.readyState == 4)
                        myobj.innerHTML = myvar.responseText;
                };
                myvar.open("GET","default.aspx?dir="+dir,false);
                myvar.send(null);
            }
        </script>
    </head>
    <body>
    <div id="update">
    </div>
    <div style="float: left;">
    <form action="">
    <input type="text" name="dir" /> <a href="#top" onclick="refresh(document.forms[0].dir.value); return false;">Refresh list()</a>
    </form>
    </div>
    </body>
    </html>
    Thanks for the help!

  • #2
    Senior Coder BarrMan's Avatar
    Join Date
    Feb 2005
    Location
    Israel.
    Posts
    1,644
    Thanks
    69
    Thanked 83 Times in 82 Posts
    Solved! The answer is:
    Code:
    myvar.open("GET","Default.aspx?dir="+dir,true);


  •  

    Posting Permissions

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