var xhr = new XMLHttpRequest(); xhr.open("POST", "http://www.baidu.com", true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.onreadystatechange = function() { if(xhr.readyState == 4 && (xhr.status == 200 || xhr.status == 304)) { console.log(xhr.responseText); } }; xhr.send("id=1&name=xmsb");