Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在不关闭弹出窗口的情况下,如何向服务器提交表单值_Javascript_Jsp - Fatal编程技术网

Javascript 在不关闭弹出窗口的情况下,如何向服务器提交表单值

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

问题:我有一个弹出窗口,它在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
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);
我还想补充一点,你应该能够在弹出窗口中通过表单进行常规发布,而无需关闭它。这只是另一个浏览器窗口