URL 创建 http://localhost/ci_search/product_filter/1?brand=Honor&brand=Infinix&brand=VIVO我要的网址http://localhost/ci_search/product_filter/1?brand=Honor,Infinix,VIVO<form id="form" method="GET" action="<?= base_url('product_filter/filter_url') ?>"><div class="container"> <div class="row">foreach($brand_data->result_array() as $key=>$row) { ?> <div class="list-group-item checkbox"> <label><input type="checkbox" name="brand[]" class="common_selector brand" value="<?php echo $row['product_brand']; ?>" > <?php echo $row['product_brand']; ?></label> </div> <?php } ?></div>查询器$(document).ready(function(){$(".brand").change(function() {if(this.checked) { //Do stuff alert(get_filter('brand')); $("#form").submit();}});function get_filter(class_name) { var filter = []; $('.'+class_name+':checked').each(function(){ filter.push($(this).val()); }); return filter; }});
1 回答
牧羊人nacy
TA贡献1862条经验 获得超7个赞
起初我曾经使用post 请求implode拆分数组
$brand=$this->input->post('brand');
$brands=implode(",",$brand);
然后我重定向到一个 url 获取请求
redirect(base_url('product/category/detail?').'brand='.$brands);
- 1 回答
- 0 关注
- 95 浏览
添加回答
举报
0/150
提交
取消