title: How to go back to a function in jquery
body: <p>I have some buttons when a user click one of them they update the content of the page through ajax then the buttons are hidden and some new buttons are available for user. The problem is when i hit the back button it doesn't go back to the previous function. I want the user to go back to the previous set of buttons here is my code :</p>
  
  <pre><code>$(".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+'&amp;var1='value;
      myQuery(query);
      $('#div3').css("display","block");
  });
  </code></pre>
  
  <p>Now div2 is shown to the user.... myQuery function does the ajax query</p>
  
  <pre><code>function myQuery(url) {
      if (window.XMLHttpRequest) {
          xmlHttp = new XMLHttpRequest();
      } else {
          xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
      }
      xmlHttp.onreadystatechange = function() {
          if (xmlHttp.readyState == 4 &amp;&amp; xmlHttp.status == 200) {
              document.getElementById("sql").innerHTML = xmlHttp.responseText;
          }
      }
      xmlHttp.open('GET', url, true);
      xmlHttp.send(); 
  }
  </code></pre>