Updating div after full page refresh following AJAX request

Posted by TonE on Stack Overflow See other posts from Stack Overflow or by TonE
Published on 2010-06-09T09:46:47Z Indexed on 2010/06/11 9:22 UTC
Read the original article Hit count: 237

Filed under:
|
|
|
|

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.)

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about JavaScript