I'm using JQuery and I am trying to find a means of replacing the entire page with the contents of an ajax load. I've found answers that suggest how to do it from the loading page, but I would like to do it from the loaded page if possible.
I have a webapp that uses a lot of ajax calls. The problem is if the user is at such a page and wanders off for long enough that the session timeout is triggered, then the app invalidates the session and the next time the user interacts with the displayed page the system returns the home page asking them to log in again. Of course - the home page appears embedded in whatever page they were last looking at rather than replacing it. Is there anything I can put in my homepage that will ensure it always replaces the entire page rather than having to check every ajax call for the home page being returned?
I'm not sure what you are getting at with the session. But if you would just like to reload the page contents using ajax, this should work:
$.ajax({
type:'post',
data:{},
url:'your url',
dataType:'html',
success:function(response){
$('body').html(response);
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With