title: How do i get an amount per page in Ajax/php/sql
body: <p>I have a problem to get an amount per page. I use a script with items per page (60 pieces) but I want to have the option to choose an amount.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
              $(document).ready(function(){ 
                  function loading_show(){
                      $('#loading').html("&lt;img src='./img/loading.gif'/&gt;").fadeIn('fast');
                  }
                  function loading_hide(){
                      $('#loading').fadeOut('fast');
                  }                 
                  function loadData(page){
                      loading_show();                    
                      $.ajax
                      ({
                          type: "POST",
                          url: "load_data.php",
                          data: "page="+page,
                          success: function(msg)
                          {
                              $("#container").ajaxComplete(function(event, request, settings)
                              {
                                  loading_hide();
                                  $("#container").html(msg);
                                  //Put code here like so
                                  $('html, body').animate({ scrollTop: 0 }, 1000);                                
                              });
                          }
                      });
                  }
                  loadData(1);  // For first time page load default results
                  $('#container .pagination li.active').live('click',function(){
                      var page = $(this).attr('p');
                      loadData(page);
  
                  });
                  $("#aantal").live('change',function(){
                      var aantal = $('#aantal :selected').val();
                      alert('Aantal per pagina:'+aantal);
                      // alert('hello');
                  }); 
                  $('#go_btn').live('click',function(){
                      var page = parseInt($('.goto').val());
                      var no_of_pages = parseInt($('.total').attr('a'));
                      if(page != 0 &amp;&amp; page &lt;= no_of_pages){
                          loadData(page);  
                      }else{
                          alert('Enter a PAGE between 1 and '+no_of_pages);
                          $('.goto').val("").focus();
                          return false;
                      }
                  });                
              });
          &lt;/script&gt;
  </code></pre>
  
  <p>This is the selectbox:</p>
  
  <pre><code>&lt;select name='aantal' class='aantal' id='aantal'&gt;
            &lt;option value='10'&gt;10&lt;/option&gt;
            &lt;option value='60' selected='selected'&gt;60&lt;/option&gt;
            &lt;option value='1000'&gt;all&lt;/option&gt;
          &lt;/select&gt;
  </code></pre>
  
  <p>And this is the load function.</p>
  
  <pre><code>&lt;?php
  if($_POST['page'])
  {
  $page = $_POST['page'];
  $cur_page = $page;
  $page -= 1;
  $per_page = ($_POST["aantal"] &lt;&gt; "" &amp;&amp; is_numeric($_GET["aantal"]) ) ? intval($_GET["aantal"]) : 60;
  $previous_btn = true;
  $next_btn = true;
  $first_btn = true;
  $last_btn = true;
  $start = $page * $per_page;
  include"db.php";
  ?&gt;
  </code></pre>
  
  <p>When I do, I get the alert box. But how can I select amount per page?</p>