JavaScript AJAX


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");

 

posted @ 2022-06-06 16:22  何效名  阅读(15)  评论(0编辑  收藏  举报