我正在尝试POST
使用 javascript 发送请求。下面是代码片段-
for (var i = 0; i < elements.length; i++) {
var uid = i;
var http = new XMLHttpRequest();
var params = 'uid='+uid;
http.open('POST','/home/index.php', true);
http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
http.setRequestHeader('Content-length', params.length);
/*
http.onreadystatechange = function() {
if(http.readyState == 4 && http.status == 200) {
continue;
}
}
*/
http.send(params);
}
从 firebug 运行脚本后,没有发送任何请求。
错误在哪里?