Hey everyone,
I’m having some trouble with Javascript. Here’s the situation. I have a popup form, which lets the user select an image from a library. There’s a button on that page that loads another page in the same popup window where the user can upload an image to add to the library.
Now, I’d like to have a popup that says “Please wait while your image is being uploaded” to let the user know that their image is uploading. Popping it up is no problem with onSubmit, but getting rid of it when the upload is complete is harder. After the upload is complete, PHP calls the header function to change the location back to the previous page where the user will now see the uploaded image added to the list he can choose from.
Now, I can’t get rid of the popup before the redirect because nothing can be written to the page before the header. So I figured that we could call a JavaScript function in the window that lets the user choose from the images to close the popup window, so that PHP redirects and the page redirected to closes the popup, but that doesn’t work. The other page doesn’t recognize the popped up window.
The window is popped up like this: window.open(‘waiting.php’,‘waiting’,‘height=200,width=200’);
The popup window is thus named waiting, so in the other page I have
waiting.close();
That didn’t work, so I used alert to see if it recognized the window using
alert(waiting);
but the alert is simply ignored.
How could I solve this ?