XMLHttpRequest里的setRequestHeader到底怎么用
展开全部
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);
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);
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询