简体   繁体   中英

Ajax error ready state failed

Thre ready state and status are not 4 and 200..why?

Here is the code:

      var myRequest=createXmlHttpRequestObject();
  var serverAddress="form.php?thread_id="+1;

  function doWork()
  {
      if(myRequest!=null)
      {

         myRequest. open("GET", serverAddress,true);
          myRequest.onreadystatechange=display;
           myRequest.send(null);
      }
  }



UPDATE:
on the server I dont get the get variable:

      if( isset($_GET["thread_id"]) )
  {
      echo 'Success'; // I never get to here..why?
  }
  else
  {
       echo ' NO SUCCESS: '.$_SERVER['SCRIPT_NAME'];
  }

The request goes through a number of other states before reaching state 4. The event handler will be called multiple times, once for each time the state changes. (eg there will be a time when the connection has changed from 'unsent' to 'opened', which is a change in state so the event will fire then).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM