title: pagination with AJAX url
body: <p>Im beginner in AJAX &amp; JS so please bear with me.</p>
  
  <p>I use this AJAX for the pagination :</p>
  
  <pre><code> $(function () {
       var keyword = window.localStorage.getItem("keyword");
  
       //pagination
       var limit = 3;
       var page = 0;
       var offset = 0;
  
       $("#btnLoad").on('click', function () {
           page++;
           if (page != 0)
               offset = (page - 1) * limit;
  
           $.ajax({
               url: "http://localhost/jwmws/index.php/jwm/search/msmall/" + keyword + "/" + limit + "/" + offset, //This is the current doc
               type: "GET",
               error: function (jq, st, err) {
                   alert(st + " : " + err);
               },
               success: function (result) {
                   alert("offset=" + offset + " page =" + page);
                   //generate search result
                   $('#search').append('&lt;p style="float:left;"&gt;Search for : ' + keyword + '&lt;/p&gt;' + '&lt;br/&gt;' + '&lt;p&gt;Found ' + result.length + ' results&lt;/p&gt;');
  
                   if (result.length == 0) {
                       //temp
                       alert("not found");
                   } else {
                       for (var i = 0; i &lt; result.length; i++) {
                           //generate &lt;li&gt;
                           $('#list').append('&lt;li class="box"&gt;&lt;img class="picture" src="images/HotPromo/tagPhoto1.png"/&gt;&lt;p class="name"&gt;&lt;b&gt;Name&lt;/b&gt;&lt;/p&gt;&lt;p class="address"&gt;Address&lt;/p&gt;&lt;p class="hidden"&gt;&lt;/p&gt;&lt;/li&gt;');
                       }
  
                       var i = 0;
                       $(".box").each(function () {
                           var name, address, picture, id = "";
                           if (i &lt; result.length) {
                               name = result[i].name;
                               address = result[i].address;
                               picture = result[i].boxpicture;
                               id = result[i].mallid;
                           }
  
                           $(this).find(".name").html(name);
                           $(this).find(".address").html(address);
                           $(this).find(".picture").attr("src", picture);
                           $(this).find(".hidden").html(id);
                           i++;
                       });
  
                       $(".box").click(function () {
                           //alert($('.hidden', this).html());
                           window.localStorage.setItem("id", $('.hidden', this).html());
                           $("#pagePort").load("pages/MallDetail.html", function () {});
                       });
  
                   }
               }
           });
       }).trigger('click');
  
   });
  </code></pre>
  
  <p>Please notice that i use the variables for pagination in the <code>url:</code>. I tried to alert the page and offset variable, and its working fine.</p>
  
  <p>However, the AJAX only working for the first page (when page load). The rest is not working even though the page and offset variable's value is true.</p>
  
  <p>Theres no warning/error in console. The data just not shown.</p>
  
  <p>Any help is appreciated, Thanks :D</p>