0

Please see my code below:

        var callback = function(popup_window) {
            popup_window.close();
           //some more codes here
        };
        var prepare = function(cb) {
            popup_window = window.open("my_url");
            this.cb(popup_window);
        };
        function refresh(){
            prepare(callback);
        };

How can I pass the popup_window variable to the callback function ?

3
  • 3
    You already are passing popup_window to the callback in your code this.cb(popup_window);. What do you really mean? Note: why this.cb()? I wouldn't expect that to work, while cb() should work. Commented Sep 21, 2011 at 6:18
  • what do u actually want to do? Commented Sep 21, 2011 at 6:21
  • I am trying to pass popup_window but this actually not passed to callback function because my window did not closed. I am trying to close the opened window. Commented Sep 21, 2011 at 6:22

3 Answers 3

1
 var prepare = function(cb) {
        var popup_window = window.open("my_url");
        cb(popup_window);
    };
Sign up to request clarification or add additional context in comments.

Comments

1

Change this.cb(popup_window); to cb(popup_window);

Comments

0

Replace this.cb() with cb()

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.