我在我们的网站上使用w3schools下面的代码,我得到status = 0和readystate 0和statustext作为空值。请让我知道我需要做些什么来让它运行。
代码:
function delete_image(val)
{
var status = confirm("Are you sure you want to delete ?");
if(status==true)
{
var xhttp;
xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
console.log(xhttp.status);
if (xhttp.readyState == 4 && xhttp.status == 200) {
console.log(xhttp.status);
document.getElementById("txtHint").innerHTML = xhttp.responseText;
}
};
xhttp.open("GET", "/~vinayemmadi/delete_image.php", true);
xhttp.send();
}
}