0
这是一个在线工作的脚本,仍在我的生产PC上。 由于某种原因,它不再有效。它似乎永远不会返回“200”的状态。所以永远不会完成。我怀疑这是供应商的故障,但不知道是什么或为什么。脚本不再运行
function loadComents(selected_video_id){
if(selected_video_id == 0){
document.getElementById("videoComents").innerHTML = '<div align="center"><font size="+2">No coments for Play List</font></div>';
} else {
// Create our XMLHttpRequest object
var hr = new XMLHttpRequest();
// Create some variables we need to send to our PHP file
var url = "video_coments.php";
var vars = "selected_video_id="+selected_video_id;
hr.open("POST", url, true);
// Set content type header information for sending url encoded variables in the request
hr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
// Access the onreadystatechange event for the XMLHttpRequest object
hr.onreadystatechange = function() {
if(hr.readyState == 4 && hr.status == 200) {
var return_data = hr.responseText;
document.getElementById("videoComents").innerHTML = return_data;
}
}
// Send the data to PHP now... and wait for response to update the status div
hr.send(vars); // Actually execute the request
document.getElementById("videoComents").innerHTML = '<div align="center"><font size="+2">processing...</font><br /><br /></div>';
}
}
我的控制台给出了这个。
SCRIPT7002: XMLHttpRequest: Network Error 0x2ef3, Could not complete the operation due to error 00002ef3.
如果此代码已过时,有人可以帮助更好的仍然有效的代码。