Reputation: 1
When I used document.location.reload()
as in case1 below, it doesn't work. But when I add an alert()
as in case2, it works. I want to figure out what happened?
//case1: does not work
document.location='rc_msg.php?remove=0';
document.location.reload();
//case2: work
document.location='rc_msg.php?remove=0';
document.location.reload();
alert("OK!!");
I did not notice I entered '=' twice, I am sorry about that. I had tried the opinion solution below, but they did not work neither
Upvotes: 0
Views: 120
Reputation: 104840
document.location returns a string, now deprecated and replaced by document.URI.
window.location (or location) is an object with a reload method.
Upvotes: 1
Reputation: 3586
Do you want to test the location (double equals) or assign it the new location (single equals)?
Try:
document.location='rc_msg.php?remove=0';
document.location.reload();
Upvotes: 1