有 3 个下拉菜单
select#opt-category,select#opt-sector,select#opt-company
类别 onchange
$("select#opt-category").change(function () {
category = $(this).val();
if(sector!='')sector='';
if(company!='')company='';
$("#opt-sector").load('menus.php?category='+category);
$("#opt-company").load('menucmp.php?category='+category);
});
将根据显示的类别和结果加载部门和公司
$(".showgrid").load('portal.php?category='+category+'§or='+sector+'&company='+company);
结果基于分页,也称为 ajax
function loading_show(){
$('#loading').html("<img src='assets/img/ajax-loader.gif'/>").fadeIn('slow');
}
function loading_hide(){
$('#loading').fadeOut('slow');
}
function loadData(page,category){
loading_show();
$.ajax
({
type: "POST",
url: "pagination_data.php",
data: {'page':page,'category':category},
success: function(msg)
{
$("#container").ajaxComplete(function(event, request, settings)
{
loading_hide();
$("#container").html(msg);
});
}
});
}
loadData(1,<?php echo $catgory?> ) // For first time page load default results
$('#container .pagination li.active').live('click',function(){
var page = $(this).attr('p');
var category= $(this).attr('q');
loadData(page,category);
});
$('#go_btn').live('click',function(){
var page = parseInt($('.goto').val());
var category = parseInt($('.total').attr('b'));
var no_of_pages = parseInt($('.total').attr('a'));
if(page != 0 && page <= no_of_pages){
loadData(page,category);
}else{
alert('Enter a PAGE between 1 and '+no_of_pages);
//$('.goto').val("").focus();
return false;
}
});
当类别下拉列表更改时,它将新值加载到其他下拉列表中,但无法将结果加载到.showgrid
.
有没有其他方法可以完成这项任务