2
$(document).ready(function(){

  function loading_show(){
    $('#loading').html("<img src='imagesnew/searching.GIF'/>").fadeIn('fast');
  }

  function loading_hide(){
    $('#loading').fadeOut('fast');
  }   


  function loadData(page){

    loading_show();                    
    $.ajax
    ({
        type: "POST",
        url: "results.php",
        data: "page="+page+"&city="+city+"&checkin="+checkin+"&checkout="+checkout, 

        success: function(msg)
        {
            $("#ListingContainer").ajaxComplete(function(event, request, settings)
            {
                loading_hide();
                $("#ListingContainer").html(msg);
            });
        }
    });
  }

  loadData(1);  // For first time page load default results

  $('#ListingContainer .pagination li.active').live('click',function(){
    var page = $(this).attr('p');

    loadData(page);$('body,html').animate({scrollTop: 0}, 800);return false;

  });   

  $('#go_btn').live('click',function(){
    var page = parseInt($('.goto').val());
    var no_of_pages = parseInt($('.total').attr('a'));
    if(page != 0 && page <= no_of_pages){
        loadData(page);
    }else{
        alert('Enter a PAGE between 1 and '+no_of_pages);
        $('.goto').val("").focus();
        return false;
    }

  });
});

分页工作完美。在左侧,我有复选框来过滤结果,将查询发送到 results.php 文件。我怎样才能实现过滤?请帮助我,因为我是新手

4

1 回答 1

2

要过滤选中/不选中的复选框,您必须进行如下检查,

if ($('#selected').is(':checked')) {
  //send the value in Ajax
} else {
  //dont send the value Ajax
} 
于 2012-12-19T12:00:45.067 回答