closing a window

Posted on 2006-06-06
Last Modified: 2012-05-05
I have a pop up window with two buttons. The ok will submit to a process page which will do  some server side processing. Once this has been completed, How can I close the popup window?
Question by:inzaghi
    LVL 30

    Expert Comment

    Sounds like a web-application and sounds like the same pop-up window needs to be notified by the server once it has finished the processing. Since this might be asynchronous, did you try AJAX?

    Author Comment

    Have not tried Ajax, coudn't I just use  javascript at the end of the page



    LVL 10

    Accepted Solution

    Non-AJAX way

    When you hit submit, the control will go to the server and your browser will wait for
    a response. Until that is returned, you'll see a blank page. You can execute closing
    by returning a "text/javascript" content-type response from the server, containing
    the following code:

    "<script type=\"text/javascript\">self.close();</script>"

    AJAX way
    AJAX being asynchronous, you can continue to display the page even after the submit
    has been clicked. In the background, the server processes and once it returns the
    response, a callback handler takes the response and executes it.


    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    Suggested Solutions

    Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
    Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
    Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
    Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now