i have 4 check box
<input type="checkbox" name="1" id="1" data-toggle="toggle" data-onstyle="default" data-width="500%" >
<input type="checkbox" name="2" id="2" data-toggle="toggle" data-onstyle="default" data-width="500%" >
<input type="checkbox" name="3" id="3" data-toggle="toggle" data-onstyle="default" data-width="500%" >
<input type="checkbox" name="4" id="4" data-toggle="toggle" data-onstyle="default" data-width="500%" >
i want if some one "check" a check box ajax send the id of that check box and {0,1} depend on if checked then 1 , if unchecked 0 to a php script via post asap its checked or unchecked
<?php
if($_POST['id'] && $_POST['state'])
{
$id = $_POST['id'];
$state= $_POST['state'];
print $id;
print $state;
}
?>
some thing like this.
if checbox1 == checked:
post(checkbox1[id],1)
if(checkbox1== unchecked)
post(checkbox1[id],0)
how can i do this,
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…