sdifjow
var method = "post";
var xhr = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
xhr.onreadystatechange = function(){
if(xhr.readyState === 4 && xhr.status === 200){
alert(xhr.responseText);
}
};
if(method === "post"){
xhr.open("post","t.php");
xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xhr.send("name=john");
}else{
xhr.open("get","t.php");
xhr.send();
}

浙公网安备 33010602011771号