Examples of two methods of using POST to pop up Windows
- 2020-03-30 01:36:47
- OfStack
Recently I need to make a popover for a function, but I can't use the get method, because the get method has a limit on the length of the url, so I must use post, which summarizes two methods
1.
2.
These two methods are not too bad in effect, they both pop up a window, and then let the popup window to post
1.
var $form1=$("<form action='"+url+"' id='f' name='f' method='post'></form>");
$form1.append($("<input type='hidden' name='"+i+"' value='"+params[i]+"'/>"));
var scriptStr="<script type='text/javascript'>document.f.submit();</script>";
$("body").append($form1);
var newWindow=openwin("",null,800,600);
newWindow.document.write($form1[0].outerHTML+scriptStr);
2.
var $form1=$("<form action='"+url+"' id='f' name='f' target='newWindow1' method='post'></form>");
for(var i in params){
$form1.append($("<input type='hidden' name='"+i+"' value='"+params[i]+"'/>"));
}
$("body").append($form1);
var newWindow=openwin("",'newWindow1',800,600);
$form1.submit();
These two methods are not too bad in effect, they both pop up a window, and then let the popup window to post