setTimeout() problem

Discussion in 'JavaScript' started by st3v1nsk1, Apr 11, 2005.

  1. #1
    Hey all!


    I've got a (small) problem. I've got a main window and an popup window. What I want to do is get the information from the popup window put it in an array in the session, close the popup window and refresh the main window.

    For some reason I need to use the setTimeout function for all this. I've tried it without but then my information isn't processed quickly enough, so my main window refreshes but since the information isn't yet in the session, still the old data is displayed...

    This is the code I'm trying to use:
    
    function reloadIt()
    {
    	opener.location = 'cases.php?doAddEmails=1';
    }
    
    function closePopup()
    {
    	window.close();
    }
    
    function doIt()
    {
    	setTimeout('reloadIt();',1000);
    	setTimeout('closePopup();',1000);
    }
    
    PHP:
    I've connected this code to a button with 'onclick:doIt()'. But this code doesn't work for some reason... Can somebody help me finding out what I've done wrong?


    Thanks in advance!

    st3v1nsk1
     
    st3v1nsk1, Apr 11, 2005 IP
  2. marty

    marty Peon

    Messages:
    154
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Hello st3v1nsk1,

    So what exactly do you mean by not working?

    I played around a little with your JavaScript and it looks to me like your closePopup() is trying to close the main window and not the pop up window.

    Good luck...

    Marty
     
    marty, Apr 21, 2005 IP