Two ways to pop up windows using post
Recently in doing a function need to pop windows, but can not use get way, because get way to the length of the URL is limited, so must use post, summed up two methods, you can refer to the following
1. The code is as follows:
var $form 1=$ ("<form action= '" +url+ "' id= ' F ' name= ' F ' method= ' post ' ></form>");
$form 1.append ($ ("<input type= ' hidden ' name= '" +i+ "' value= '" +params[i]+ "'/>"));
var scriptstr= "<script type= ' Text/javascript ' >document.f.submit ();</script>";
$ ("Body"). Append ($form 1);
var Newwindow=openwin ("", null,800,600);
NewWindow.document.write ($form 1[0].outerhtml+scriptstr);
2. The code is as follows:
var $form 1=$ ("<form action= '" +url+ "' id= ' F ' name= ' F ' target= ' newWindow1 ' method= ' post ' ></form>");
for (var i in params) {
$form 1.append ($ ("<input type= ' hidden ' name= '" +i+ "' value= '" +params[i]+ "'/>"));
}
$ ("Body"). Append ($form 1);
var Newwindow=openwin ("", ' NewWindow1 ', 800,600);
$form 1.submit ();
Both of these methods are similar in effect, it is to pop a window first, and then let the pop-up window for post submission.
Two ways to pop up windows using post