开发者

without closing the popup window, how to submit the form value to server

Question: I have one popup window it contains some values in textbox开发者_如何转开发 and textarea. I need to submit the value to server without closing the popup window.

Is there any way....

Thanks in Advance


Yes, use Ajax with 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);

I would also add that you should be able to do a regular POST via form in the popup without closing it anyway. Its just another browser window...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜