index.php
if ($('.chkNumber:checked').length) {
var chkId = '';
$('.chkNumber:checked').each(function () {
chkId += $(this).val() + ",";
});
chkId = chkId.slice(0, -1);
//alert(chkId);
var datastring='chkId='+chkId;
//alert(datastring);
$.ajax({
type: "POST",
url: "delete.php",
data:datastring,
cache:false,
beforeSend: function()
{
$("#signup_status").html("please wait....");
},
success:function(response)
{
alert(response);
$("#signup_status").html(response)
}
});
}
else {
alert('Nothing Selected');
}
}
-------------------------------------------------------------------------------------------------------------------
checkbox code:-
<input name="checkbox[]" type="checkbox" class="chkNumber" />
--------------------------------------------------------------------------------------------------------------------
retrieve checkbox :-
$chkId=$_POST['chkId'];
$count=explode(',',$chkId);
for($i=0;$i<$count[$i];$i++)
{
$del_qry="delete from gunning_3001 where id='$count[$i]'";
$res=mysql_query($del_qry) or die('Delete query does not work');
if($res)
{
echo "Delete Records Successfully";
}
else
{
echo "No Records Deleted";
}
}
---------------------------------------------------------------------------------------------------------------------