Updating div after full page refresh following AJAX request
- by TonE
Hi,
I have an AJAX controller action which returns JSON. The returned JSON is handled via jQuery and contains a message displayed in an update div. The JSON also contains a flag which indicates a change in state. If this is true the entire page needs to be reloaded from a different url. This is currently performed in the jQuery using window.location.replace(url).
In the situation where a full page refresh occurs, I still want to display the message from the JSON in the update div, but after the page has fully reloaded.
How can I ensure the div is updated with the message after the window.location.replace call and the page has been completely reloaded?
Thanks.
(I realise AJAX is not intended for full page refreshes but I can't think of a simple way of avoiding it in this scenario. Normal behaviour here is updating the div with a status message.)