问题:我有一个弹出窗口,它包含textbox和textarea中的一些值。 我需要在不关闭弹出窗口的情况下将值提交给服务器。
有什么办法......
先谢谢
答案 0 :(得分:1)
是的,使用带有POST的Ajax:
var url = "get_data.php";
var params = "lorem=ipsum&name=binny";
http.open("POST", url, true);
//Send the proper header information along with the request
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.setRequestHeader("Content-length", params.length);
http.setRequestHeader("Connection", "close");
http.onreadystatechange = function() {//Call a function when the state changes.
if(http.readyState == 4 && http.status == 200) {
alert(http.responseText);
}
}
http.send(params);
我还要补充一点,你应该可以通过弹出窗口中的表单进行常规POST而无需关闭它。它只是另一个浏览器窗口......