XMLHttpRequest里的setRequestHeader到底怎么用

XMLHttpRequest里的setRequestHeader到底怎么用


Helenr
浏览 712回答 1
1回答

MMTTMM

var method = "get";var url = "test.php";var async = true;var data = "username=" + encodeURIComponent(username) + "&password=" + encodeURIComponent(password)xmlHttp.open(method, url, async);//设置回调函数,接收服务器端的信息以进行处理xmlHttp.onreadystatechange = getServerInfo;//想服务器端发送内容,为什么不起作用呢?xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");xmlHttp.setRequestHeader("Content-Length", data.length);xmlHttp.send(data);
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JQuery