Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    making an ajax call in the opener of a window

    hi,

    i've got a page that when you click on a link, javascript opens a new window. what i'm trying to do is make it so that when the new window is closed, a callback function is executed that uses ajax to update the document in the opener window.

    i'm using jquery, but that's just to make things easier. here's the code i've put in the new window:

    $(window).unload(function() { window.opener.refreshPage(); });

    pretty simple - it just calls the window.opener.refreshPage method when the new window's onUnload event is triggered.

    in the opener window's document, there is a function, refreshPage that makes a simple ajax call. The ajax call works fine when i run it myself from within the browser on the opener document. however, when i close the new window, refreshPage is called, but the post request doesn't run. i'm using firefox, and firebug doesn't give a specific error. i think what's happening is because refreshPage is being called from a window just before it is closed, that execution of refreshPage is terminated milliseconds after it begins.

    so, my question is, how can i run a callback function when a new window is closed?

    thank in advance,
    al

  • #2
    New to the CF scene
    Join Date
    Jul 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    problem solved. this web page helped me fix it:

    http://www.captain.at/howto-ajax-par...lose-error.php


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •