如何返回jquery中的函数


How to go back to a function in jquery

我有一些按钮,当用户单击其中一个按钮时,它们会通过ajax更新页面的内容,然后这些按钮被隐藏,一些新按钮可供用户使用。问题是当我按下后退按钮时,它不会返回到上一个功能。我想让用户回到上一组按钮这里是我的代码:

$(".buttonset1").click(function() {
    $('#div1').css("display","none");
    id = $(this).attr("value");
    query = 'ajax.php?id='+id;
    myQuery(query);
    $('#div2').css("display","block");
});
$(".buttonset2").click(function() {
    $('#div2').css("display","none");
    value = $(this).attr("value");
    query = 'ajax.php?id='+id+'&var1='value;
    myQuery(query);
    $('#div3').css("display","block");
});

现在div2显示给用户。。。。myQuery函数执行ajax查询

function myQuery(url) {
    if (window.XMLHttpRequest) {
        xmlHttp = new XMLHttpRequest();
    } else {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
            document.getElementById("sql").innerHTML = xmlHttp.responseText;
        }
    }
    xmlHttp.open('GET', url, true);
    xmlHttp.send(); 
}

解决了非常简单的

 History.Adapter.bind(window,'statechange',function(){ // Note: We are using statechange instead of popstate
    var State = History.getState(); // Note: We are using History.getState() instead of event.state 
    var url = State.url;    
    myQuery(url);   
});