I am trying to figure out history API but after reading the documentation I barely understand anything.
For example I have the following AJAX:
$("#hund").click(function(e) {
e.preventDefault();
$(".result").load("hund.html #content", function() {
});
The following browser URL manipulation:
var stateObj = { foo: "bar" };
history.pushState(stateObj, "page 2", "bar.html");
This I understand. Click something, change the url. Click back, change the url back.
But I want, if the back button is clicked after the AJAX click, I want the AJAX call to be reversed. In that case, that would be the result div to be emtpy again, or if you have clicked several things and then clicked back, the previous stuff to be loaded.
How would I achieve this effect?