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
    New Coder
    Join Date
    Nov 2005
    Posts
    93
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Ajax script does not work in IE

    Hi,

    The following script works perfectly on FF but on IE it shows the result for the first time but does not refresh.


    Code:
    <style type="text/css">
    .ticker {
      padding: 10px;
      border: 1px solid #000;
      background: #A7FF84;
      width: 400px;
      font-family: arial;
      font-size: 12px;
    }
    </style>
    <script type="text/javascript">
    var xmlHttp;
    try
      {
      // Firefox, Opera 8.0+, Safari
      xmlHttp=new XMLHttpRequest();
      }
    catch (e)
      {
      // Internet Explorer
      try
        {
        xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
        }
      catch (e)
        {
        try
          {
          xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
          }
        catch (e)
          {
          alert("Your browser does not support AJAX!");
    //     return false;
          }
        }
      }
      var init_ticker = function(){
        xmlHttp.open("GET", "data1.php", true);
    	xmlHttp.send(null);
    xmlHttp.onreadystatechange = function()
    {
    	  if(xmlHttp.readyState == 4){
    	    document.getElementById("special_ticker").innerHTML = xmlHttp.responseText;
    	  }
    	};
      };
      setInterval(init_ticker, 1000);
      window.onload = init_ticker;
    </script>
    
    
    
    
     <div class="ticker" id="special_ticker">Loading...</div>
    could someone tell me what is wrong.

    Thanks

  • #2
    bdl
    bdl is offline
    Regular Coder
    Join Date
    Apr 2007
    Location
    Camarillo, CA US
    Posts
    590
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Common caching issue with IE.

    Please read this thread and my reply post explaining how to get around this problem.

    Wikipedia : XMLHttpRequest object - known problems


  •  

    Posting Permissions

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