Javascript 在不关闭弹出窗口的情况下,如何向服务器提交表单值
问题:我有一个弹出窗口,它在textbox和textarea中包含一些值。 我需要在不关闭弹出窗口的情况下将值提交到服务器 有没有办法Javascript 在不关闭弹出窗口的情况下,如何向服务器提交表单值,javascript,jsp,Javascript,Jsp,问题:我有一个弹出窗口,它在textbox和textarea中包含一些值。 我需要在不关闭弹出窗口的情况下将值提交到服务器 有没有办法 提前感谢是的,将Ajax与POST结合使用: 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
提前感谢是的,将Ajax与POST结合使用:
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);
我还想补充一点,你应该能够在弹出窗口中通过表单进行常规发布,而无需关闭它。这只是另一个浏览器窗口