<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="
http://code.jquery.com/jquery-1.7.2.min.js"></script>
</head>
<body>
<?php
$data = $_POST['data'];
$arr = json_decode($data);
var_dump($arr);
$a = array(1,2,3,4);
foreach($a as $v){
?>
<input type = "checkbox" class="checkbox" name="checkbox" value="<?=$v?>">
<?php
}
?>
<input type = "button" class="but_delet_choice" value="post">
</body>
<script>
$('.but_delet_choice').click(function(){
//获取全选之外的checkbox
var $check_boxes = $("input[name='checkbox']:checked");
if($check_boxes.length<=0){
alert('您未勾选,请勾选!');
return;
}
var array = new Array();
$check_boxes.each(function(){
var array_push = new Array();
array_push.push($(this).val());
array_push.push(2);
array.push(array_push);
})
$.post(
'test1.php',
{
data : JSON.stringify(array)
}
);
return false;
});
</script>
</html>