XMLHttpRequest get post
https://www.pocketdigi.com/20110425/260.html
var xmlHttp; function createXmlHttpRequest(){ if (window.ActiveXObject) { xmlHttp = new window.ActiveXObject("Microsoft.XMLHTTP"); } else if (window.XMLHttpRequest) { xmlHttp = new XMLHttpRequest(); } } createXmlHttpRequest(); function GET(){ xmlHttp.open("GET", "3.php", true); xmlHttp.onreadystatechange = function(){ if (xmlHttp.readyState == 4 && xmlHttp.status == 200) { alert(xmlHttp.responseText); } } xmlHttp.send(null); } function POST(){ xmlHttp.open("POST","3.php"); alert("POST"); xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); xmlHttp.onreadystatechange = function(){ if (xmlHttp.readyState == 4 && xmlHttp.status == 200) { alert(xmlHttp.responseText); } } xmlHttp.send("name=zhang"); }