Jquery ajax post call, ajaxify history and return button

I have ajax calls made in jquery functions that I call with onClick options placed on a div. Example:

<div class='basic' onClick='example( <?php echo numberIwant ?> )'> example </div>

and functions that look like this:

function example(ID){
    $.ajax({
        type: "POST",
        url: "example.php",
        data: "ID="+ID, success: function(msg){$("#main").html(msg);}
    });
}

Now I want the browser return button to work to open the previous page (ajax content). I googled and tried several scripts like ajaxify and history.js, and so on, but I just can't get it to work.

I don’t know if I can either not know how to use ajaxify correctly, or just work with this method.

Can anyone help me?

+4
source share

All Articles