title: jquery paginate without update function
body: <p>Im writting a newsfeed, and I wonder how i would paginate on a page that does not refresh. When i click on a button i perform a json request to get new data, but i do not refresh the page.</p>
  
  <p>Here is what i have:</p>
  
  <p>HTML</p>
  
  <pre><code>&lt;!-- Forum --&gt;
  &lt;div id="forum"&gt;&lt;center&gt;Loading forum...&lt;/center&gt;&lt;/div&gt;
  &lt;!-- Forum pagination --&gt;
  &lt;ul class="pager"&gt;
    &lt;li class="previous" id="forum-prev"&gt;
      &lt;a href="#forum-top"&gt;Prev&lt;/a&gt;
    &lt;/li&gt;
    &lt;li class="next" id="forum-next"&gt;
      &lt;a href="#forum-top"&gt;Next&lt;/a&gt;
    &lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>JS</p>
  
  <pre><code>function updateButtons()
  {
  // Button prev forum
  $("#forum-prev").click(function() {
    var page = parseInt($.cookie("page"));
    page -= 1;
    $.cookie("page", page);
    loadforum();
    updateButtons();
  });
  
  // Button next forum
  $("#forum-next").click(function() {
    var page = parseInt($.cookie("page"));
    page += 1;
    $.cookie("page", page);
    loadforum();
    updateButtons();
  });
  // Disable buttons
  if($.cookie("page") &gt;= 0)
  {
    $("#forum-prev").removeClass("active");
    $("#forum-prev").addClass("disabled");
    $("#forum-prev").unbind("click");
  }
  else
  {
    $("#forum-prev").removeClass("disabled");
    $("#forum-prev").addClass("active");
    $("#forum-prev").bind("click");
  }
  if($.cookie("page") &lt;= parseInt($.cookie("forum-count"))-1)
  {
    $("#forum-next").removeClass("active");
    $("#forum-next").addClass("disabled");
    $("#forum-next").unbind("click");
  }
  else
  {
    $("#forum-next").removeClass("disabled");
    $("#forum-next").addClass("active");
    $("#forum-next").bind("click");
  }
  }
  </code></pre>
  
  <p>What would be the best way to paginate if i do not refresh the page, and the prev button should be disabled when on <code>page 0(default)</code> and enabled when <code>page &gt; 0</code> and next should be disabled when <code>page &lt; maxPage</code>. I tried using <code>$.on()</code> <code>$.off()</code> but i have the same issue since the JS doesnt reload I cannot enable buttons or disable.</p>