//### 博文主要供自己查看,内容整理不到位的请见谅 ###
思路:
通过点击选项,来触发onChenge()这个函数(单词好像写错了),来改变URL里面的参数,重新加载新的数据,没有涉及到异步操作
HTML代码
<div class="nav">
<span style="white-space:pre"> </span><ul>
<li>性别:<a οnclick="onChenge('stu_sex','男')">男</a><a οnclick="onChenge('stu_sex','女')">女</a></li>
<li>是否入校:<a οnclick="onChenge('is_rx',1)">是</a><a οnclick="onChenge('is_rx',0)">否</a></li>
</ul>
</div>
<form>
<span style="white-space:pre"> </span><input type="hidden" value="{$inputNum['stu_sex']}" name="stu_sex" />
<span style="white-space:pre"> </span><input type="hidden" value="{$inputNum['is_rx']}" name="is_rx" />
</form>
<script type="text/javascript">
function onChenge(inputName,inputValue){
$("input[name='"+inputName+"']").val(inputValue);
var stusex=$("input[name='stu_sex']").val();
var isrx=$("input[name='is_rx']").val();
var str="stu_sex/"+stusex+"/is_rx/"+isrx;
location.href="/index.php/Home/Index/index/"+str;
}<pre name="code" class="javascript"></script>
public function index(){
$where=array();
if(I('get.is_rx')!=''){
$where['is_rx']=I('get.is_rx');
}
if(I('get.stu_sex')!=''){
$where['stu_sex']=I('get.stu_sex');
}
$this->inputNum=$where;
$count=M('zhaosheng_stu')->where($where)->count();
$Page=new\Think\Page($count,1);
$this->page=$Page->show();
$this->data=M('zhaosheng_stu')->where($where)->limit($Page->firstRow.','.$Page->listRows)->select();
$this->display();
}