Post data to a new popup window without using hidden input fields
Is it possible to post data to a new window without using hidden input fields. Data can be possibly quite large. Looking at something similar to jQuery ajax type post.. except I need to post the data to a new page.
A hidden form is the standard approach to this. I don't recall if the following has complications, but you may even be able to create the form on the fly and submit it. In my opinion, there's nothing wrong with this approach. Another possibility is to use jQuery.post() and in the callback function open a new window and paste the returned content. For example,
var win = window.open();
win.document.write(returnedContent);
eureka! this test works:
function postData() {
$.post('popup.aspx', { text1: "aaa", text2: "bbb" }, function (result) {
WinId = window.open('', 'newwin', 'width=400,height=500');
WinId.document.open();
WinId.document.write(result);
WinId.document.close();
});
}
on popup.aspx.cs
test1.Text = Request["text1"];
test2.Text = Request["text2"];
on popup.aspx
<asp:Label ID= "test1" runat="server"></asp:Label>
<asp:Label ID= "test2" runat="server"></asp:Label>
精彩评论