-3

i have created 3 to 4 different pages in an html. On navigating to 3rd page; on a particular event, i want to refresh that page. Is it possible? If yes, can you please help me with the code?

Thanks in advance

Cheers

Smern
  • 18,746
  • 21
  • 72
  • 90
Prals
  • 606
  • 3
  • 7
  • 22
  • https://www.google.se/search?q=refresh+the+page+javascript&oq=refresh+the+page+javascript&aqs=chrome.0.69i57j0l3j69i62l2.4026j0&sourceid=chrome&ie=UTF-8 – Johan Jul 22 '13 at 18:53
  • Hi Pieter, I guess its not the same with jquery mobile. If I reload in jquery mobile, the complete history gets wiped-off. Can you suggest some other alternative? – Prals Jul 22 '13 at 19:34
  • 1
    @Praleed: Then explain what you mean by "refresh the page." Normally that term means to invoke a reload on the page, which would request the original state of the page from the server again (and lose any dynamic client-side changes that haven't persisted server-side). – David Jul 22 '13 at 20:54

1 Answers1

-1

Yes you can refresh like this location.reload()

As you are using jquery mobile and don't want to use reload try changePage as below:

var url = location.href;
if (url.indexOf('?r=1') != -1 || url.indexOf('&r=1') != -1) {
  url = url.replace('?r=1', '?').replace('&r=1', '');
} else {
    if (location.href.indexOf('?') == -1) {
        url = url + '?r=1';
    } else {
        url = url + '&r=1';
    }
}
$.mobile.changePage(url);
Manoj Yadav
  • 6,560
  • 1
  • 23
  • 21