This article mainly introduces jquery to get the checkbox value and submit it in post mode. If you need a friend, you can refer to the following nonsense and directly provide the Code:
The Code is as follows:
<? Php
$ Data = $ _ POST ['data'];
$ Arr = json_decode ($ data );
Var_dump ($ arr );
$ A = array (1, 2, 4 );
Foreach ($ a as $ v ){
?>
<? Php
}
?>
Script
$ ('. But_delet_choice'). click (function (){
// Obtain the checkbox that is not included in the entire selection
Var $ check_boxes = $ ("input [name = 'checkbox']: checked ");
If ($ check_boxes.length <= 0 ){
Alert ('You have not checked, please check it! ');
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
The Code is as follows:
Array (4 ){
[0] =>
Array (2 ){
[0] =>
String (1) "1"
[1] =>
Int (2)
}
[1] =>
Array (2 ){
[0] =>
String (1) "2"
[1] =>
Int (2)
}
[2] =>
Array (2 ){
[0] =>
String (1) "3"
[1] =>
Int (2)
}
[3] =>
Array (2 ){
[0] =>
String (1) "4"
[1] =>
Int (2)
}
}
This is just a simple implementation. I will give you a reference. You can freely expand it.