Im using ajax to开发者_如何学Python 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!
Take a look at this tutorial entitled "Fixing the Back Button and Enabling Bookmarking for AJAX Apps".
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.
You can use jquery history plugin for this:
Try this simple & lightweight PathJS lib. It allows to bind listeners directly to anchors.
Usage example:
Path.map("#/page1").to(function(){
...
});
Path.map("#/page2").to(function(){
...
});
Path.root("#/mainpage");
Path.listen();
精彩评论