michaelkirby Posted April 14, 2010 Share Posted April 14, 2010 Hi, I'm new to JavaScript and starting to learn it more, but stuck on an issue and wondered if anyone could provide me with any information. I have a profile page where a picture specific to the user is displayed. Using JavaScript I have a link which opens up a pop up window of an upload form allowing the user to change the particular picture. The user can choose the picture they desire then click upload and the window automatically closes. However this is where the issue is. The main page which is where the profile picture is doesn't update the picture until the page is refreshed. I looked into ways to refresh the page which is possible by setting the refresh of the page to every 5 or 10 seconds, however this is not really practical to refresh the page every 5 or 10 seconds. Is there any better solutions to the issue at all?? Quote Link to comment Share on other sites More sharing options...
xenophobia Posted April 15, 2010 Share Posted April 15, 2010 To refer back to the window that open the child window, use "opener". opener.location.reload(true); If you wish to refresh the image only, you can simply assign an ID to the image and use the child window to refresh it: var profileImage = opener.document.getElementById("profileImage"); profileImage.src = "upload/newImage.jpg"; These codes did not tested yet. I just write it out on the spot. Please tell me if it's not working. Quote Link to comment Share on other sites More sharing options...
michaelkirby Posted April 15, 2010 Author Share Posted April 15, 2010 Hi xenophobia, I have chosen to use the first method that you suggested and it works perfectly! Thank you for helping out!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.