Two ways to pop up windows using post

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.