当我单击带有选择复选框的下一页链接时,我有一个包含作业详细信息列表和每个作业复选框的表格,以便我应该获取带有复选框值的查询字符串和链接 url 查询字符串
<input type="checkbox" class="checkJobToSend" name="checkJOb" value="<TMPL_VAR NAME=job_id>"
<input type="checkbox" class="checkJobToSend" name="checkJOb" value="<TMPL_VAR NAME=job_id>"
<input type="checkbox" class="checkJobToSend" name="checkJOb" value="<TMPL_VAR NAME=job_id>"
<input type="checkbox" class="checkJobToSend" name="checkJOb" value="<TMPL_VAR NAME=job_id>"
<input type="checkbox" class="checkJobToSend" name="checkJOb" value="<TMPL_VAR NAME=job_id>"
<a href ='index.cgi?reqpage=$prev_page&job_category_id=$jobCategory' class='paginateAdmin' id='govtPaginate'>prevPage</a>
function getJobsChecked(){
var arr = [];
var i= 0;
$('.checkJobToSend:checked').each(function(){
arr[i++] = $(this).val();
});
return arr;
}
$(document).ready(function() {
$(document).on('click','.paginateAdmin',
function(e){
e.preventDefault();
var arr = getJobsChecked();
var post = $(this).attr("href");
var array = post.split('?');
var id=$(this).attr('id');
$.post(
'job.cgi',
array[1],
function(data,status){
switch(id)
{
case "nonItPaginate":
$('#nonit').html(data);
break;
case "ItPaginate":
$('#it').html(data);
break;
case "govtPaginate":
$('#govt').html(data);
break;
default:
}
}
);
});
});
我如何用数组 [1] 和带有复选框值的 arr 形成一个查询字符串,例如
reqpage=2&job_category_id=2&checkJob=1&checkJob=2&checkJob=3