/    Sign up×
Community /Pin to ProfileBookmark

Reload Page without POSTDATA

I have a page that I need to reload from a popup.

Sometimes, this page is loaded with POST data, and sometimes it is not. So, on the reload, sometimes I get asked if I want to resubmit the postdata.

At the point where I will be doing the reload, the POST data is no longer relevant, so I would like some javascript code to automatically refresh the page without any postdata.

Any suggestions?

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@Michael2003May 09.2004 — <script type="text/javascript">
window.location=window.location;
</script>

That should do the trick as long as it is only outputted when there is post data (I am assuming that you have server side stuff going on so that would be possible.

However, if you already have server-side stuff why not keep it server-side and do something like:

[code=php]<?php
header("Location: http://thesite.com/page.php");
?>[/code]

When there is post data to remove the need for JS to do the job at all, and give you time to process the data.
Copy linkTweet thisAlerts:
@nudave04authorMay 09.2004 — I had code similar to your javascript code, and it works to refresh the page when there is postdata... but sometimes i want to refresh the page when there is no postdata. The page i'm workign on has a few form elements, and the postdata from some is irrelevant by the time I want to do this reload.

I tried an if statement to the effect of:

if (window.location.href == 'SITE ADDRESS') {

window.location.reload(true);

} else {

window.location = 'SITE ADDRESS'

}

But that only worked when there was no postdata... i need it to work regardless of whether there is postdata
×

Success!

Help @nudave04 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 5.18,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...