tags:

views:

179

answers:

3

Hi!

Im using ajax to call php which gets results from a mysql db. Reason im using ajax is so that the page wont reload. (RETURN FALSE)

All works fine, but since the browser doesnt reload, there is no "back".

Example: Users enter something to search for, and hits "search button" and ajax returns the search without reloading page, BUT if the user wants to click the back button to get to the previous search, they cant...

If you think it would be better to actually reload the page then tell me because this is fully possible for me, only reason I dont reload page is because it looks better this way...

Or what do you guys think of iframes?

Thanks!

+1  A: 

Take a look at this tutorial entitled "Fixing the Back Button and Enabling Bookmarking for AJAX Apps".

Dominic Rodger
+1  A: 

In conjunction with the answer to your question here, you could store their searches in an array. In the unload event, you could just do the previous search.

Buggabill
sounds okay, but how would you think is best way, iframe in the page would allow back and no problems, or using ajax? Iframe have any downsides?
Camran
Either could be used. I think (could be wrong here) a lot of people try to use ajax, because it is the "in" thing. Ajax is cool. Don't get me wrong, but if an iframe suits your and your user's needs the best, use it. The only major downside to an iframe is that the content of the iframe will not be indexed by search engines which, in your case, seems irrelevant.
Buggabill
A: 

You can use jquery history plugin for this:

jerjer
I personally like this method most.
iddqd