/    Sign up×
Community /Pin to ProfileBookmark

JavaScript – Help with closing popup on submit and more

Hello, I have a guestbook on my new site. I use a popup-window to bring up the form you fill to write in the guestbook.
But I have a problem here, what I want is that when I submit the form the popup shall close and the main page will thereafter reload by itself (with a script that activates on submit), then you will be able to see your text you’ve written immediately.

Anyone know how to do? I know php also if that could be any help.

/ Lars

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@sciguyryanMay 08.2004 — I presume the submit button is in your popup:

Add this to your submit button:

<i>
</i>&lt;script type="text/javascript"&gt;
&lt;!--
function CloseReload(){
self.close;
parent.reload();
}
//--&gt;
&lt;/script&gt;


<i>
</i>OnCLick="CloseReload();"


Hope that helps. ?
Copy linkTweet thisAlerts:
@fishtailauthorMay 08.2004 — Will try that, thanks!

--Edit--

Did work out 50%, the window close and the information is in the database but parent didn't reload.
Copy linkTweet thisAlerts:
@sciguyryanMay 09.2004 — Try (replace the parent.reload() with)

<i>
</i>parent.history.go(0);


So, as your full code you would have:

<i>
</i>&lt;script type="text/javascript"&gt;
&lt;!--
function CloseReload(){
self.close;
parent.history.go(0);
}
//--&gt;
&lt;/script&gt;
×

Success!

Help @fishtail spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...