function theLast(){
if (document.getElementById('dont').checked) {
document.getElementById('dont').checked=false;}
else if(document.getElementById('know').checked){
document.getElementById('know').checked=false;}
else if(document.getElementById('master').checked){
document.getElementById('master').checked=false;}
else {
document.getElementById('ans').reset();}
document.getElementById("pop2").style.display = 'none';
document.getElementById("myPopup").style.display = 'none';
document.getElementById("pop3").style.display = 'none';
document.getElementById("pop4").style.display = 'block';
document.getElementById('pop4').style.position = "absolute";
document.getElementById('pop4').style.top = '250px';
document.getElementById('pop4').style.left = '250px';
setTimeout(function(){
document.getElementById('pop4').className = 'waa';
}, 2500);
window.location.reload();
}
i want to reload my page at the end of this function tried window.location.reload() location.reload(true)
is there any other way i can reload my page?
function theLast(){
if (document.getElementById('dont').checked) {
document.getElementById('dont').checked=false;}
else if(document.getElementById('know').checked){
document.getElementById('know').checked=false;}
else if(document.getElementById('master').checked){
document.getElementById('master').checked=false;}
else {
document.getElementById('ans').reset();}
document.getElementById("pop2").style.display = 'none';
document.getElementById("myPopup").style.display = 'none';
document.getElementById("pop3").style.display = 'none';
document.getElementById("pop4").style.display = 'block';
document.getElementById('pop4').style.position = "absolute";
document.getElementById('pop4').style.top = '250px';
document.getElementById('pop4').style.left = '250px';
setTimeout(function(){
document.getElementById('pop4').className = 'waa';
}, 2500);
window.location.reload();
}
i want to reload my page at the end of this function tried window.location.reload() location.reload(true)
is there any other way i can reload my page?
Share Improve this question edited Sep 20, 2016 at 17:50 user663031 asked Sep 20, 2016 at 16:52 RahulRahul 151 gold badge1 silver badge5 bronze badges 10- Possible duplicate of How to reload a page using Javascript? – showdev Commented Sep 20, 2016 at 16:55
-
3
1. Clean up your code. 2. I can’t spot
window.reload
norwindow.location.reload
(which would be correct) anywhere in your code. – idmean Commented Sep 20, 2016 at 16:56 -
I don't see anywhere in the code where you're calling
window.location.reload
. That might be why its not working. – user47589 Commented Sep 20, 2016 at 16:59 -
1
"reloads the resource from the current URL". See
location.reload()
. – showdev Commented Sep 20, 2016 at 17:10 -
1
Fire up your debugger, and place a breakpoint on the
window.location.reload
line. Make sure it reaches there. Then step over the line. Your browser will reload. Most likely, you will find that control never reaches that line, because of some other error in your logic. – user663031 Commented Sep 20, 2016 at 18:53
2 Answers
Reset to default 2I'm not sure about the support for location.reload
but why don't you try this:
window.location.href = window.location.href;
$('#something').click(function() {
location.reload();
});
Add this In Your Script