Loading ...
Sorry, an error occurred while loading the content.
 

HElp on SetTimeout

Expand Messages
  • nhoj
    hello im new to javascript and im mahing my code using ajax to get the data from my database..the problem is the SetTimeout is not working on Internet
    Message 1 of 1 , Dec 5, 2006
      hello im new to javascript and im mahing my code using ajax to get the
      data from my database..the problem is the SetTimeout is not working on
      Internet Explorer..I dont have trouble in it when using mozilla based
      browser..please help me..i really need a help right now..i dont know
      what im doing wrong..here is my code below:

      # <script type="text/javascript">
      #
      # function createRequestObject() {
      #
      # var req;
      #
      # if(window.XMLHttpRequest){
      # // Firefox, Safari, Opera...//
      # req = new XMLHttpRequest();
      # } else if(window.ActiveXObject) {
      # // Internet Explorer 5+//
      # req = new ActiveXObject("Microsoft.XMLHTTP");
      # } else {
      # //error//
      # alert('Problem creating the XMLHttpRequest
      object');
      # }
      #
      # return req;
      #
      # }
      #
      #
      # function sendRequest() {
      # window.lastRequest = new Date();
      # var http = createRequestObject();
      # http.open('get', 'show.php');
      # http.onreadystatechange = function(){
      # if(http.readyState == 4 && http.status == 200){
      #
      # // Text returned FROM the PHP script
      # var response = http.responseText;
      #
      # if(response) {
      # // UPDATE ajaxTest content
      #
      document.getElementById("searchResults").innerHTML = response;
      # }
      #
      # var period = (new Date()) -
      window.lastRequest;
      # window.setTimeout( sendRequest,
      (period > 1000) ? 0 : period )
      # }
      # }
      # http.send(null);
      # }
      #
      # </script>

      thank you so much!!!
    Your message has been successfully submitted and would be delivered to recipients shortly.