[英]Ajax error ready state failed
Thre ready state and status are not 4 and 200..why? 就绪状态和状态不是4和200 ..为什么?
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. 该请求在到达状态4之前会经过许多其他状态。事件处理程序将被多次调用,每次状态更改一次。 (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). (例如,有时连接已从“未发送”更改为“打开”,这是状态的更改,因此事件将随后触发)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.