tags:

views:

31

answers:

2

Hi I am building div content with AJAX call, but when I make call to any page from loaded page, if there is any exception the content loaded from AJAX call is not there in previous page. Is there any way to stop happening that?

A: 

Ajax vs Back button

If I understand well you are pressing the browser back button.

If you don't manage the history of the browser, it will break Ajax. The browser simply goes to the last location loaded, no ajax involved. If you did 3 ajax calls/loads in the last page, back button will ignore this because it's just javascript in the page and it will go back... very back.

What you can do

There are things you can do to preserve the back semantics in your ajax app but I don't know how you do it with jquery. Maybe it has tools for that. I know something about GWT that has history managing. But it's another framework...

helios
A: 

See the History plugin. Highly recommended for this purpose.

Michael Mikowski