The pop-up window in -- Ajax pops up continuously.

Source: Internet
Author: User

For the "continuous pop-up window in Ajax" problem mentioned earlier, a solution is provided: implement the pop-up window process in front-end Js, the same content window appears each time.

This solution encountered a problem when deployed to the server. The server is IE6 and may be incompatible with the Js in the pop-up window. The content in the pop-up window cannot be loaded.

Therefore, we began to seek a second solution:

Starting from the essential principle, the reason why the same content window is not popped up for the second time is that the code for the background pop-up window call is identical (the same method and method parameters are the same)

If the code in each pop-up window in the background changes, Ajax refresh will occur. Therefore, the background code is executed every time.

Starting from this solution:

Change the method of the pop-up window in the background:

Protected void lnktab_click (Object sender, eventargs E)
{
Session ["childqx"] = 1;
If (id1 = "0 ")
{
Scriptmanager. registerstartupscript (updatepanel1, GetType (), "onclick", "showtab2 ('" + hiddpropid. Value + "')", true );
Id1 = "1 ";
}
Else
{
Scriptmanager. registerstartupscript (updatepanel1, GetType (), "onclick", "showtab3 ('" + hiddpropid. Value + "')", true );
Id1 = "0 ";
}
// Ajaxpanel2.
// Refush ();
}

By switching to call different JS, the window is displayed. Different JS files share the same content, but different names are assigned.

In this way, the code will be refreshed every time the background call occurs, and a window can pop up continuously.

This principle is simplified by using the current time as a parameter. It is more concise:

Protected void lnktab_click (Object sender, eventargs E)
{
Session ["childqx"] = 1;

Scriptmanager. registerstartupscript (updatepanel1, GetType (), "onclick", "showtab2 ('" + hiddpropid. Value + ", 'datetime. Now')", true );
Id1 = "1 ";
}

Each call has different parameter values, so the system refreshes each time and executes the background code.

Related Article

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.