Fish and Chip Shop Insurance - Proxy Myspace - Flights - Loans - Remortgages

PDA

View Full Version : setTimeout() problem


st3v1nsk1
Apr 11th 2005, 11:04 pm
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);
}

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

marty
Apr 21st 2005, 1:03 pm
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