I'm trying to delete both the checkbox and the label on success of json call. I have tried alsorts of code found here but so far have only managed to remove the checkbox.
Checkbox and label code
<label class="checkbox"><input type="checkbox" id="<?php echo $row['name']; ?>" value="<?php echo $row['id']; ?>" name="delete[]" class="checkboxAdmin" /><?php echo $row['name']; ?> - <?php echo $row['email']; ?></label>
Jquery code
$(".delete_admin_but").click(function() {
$.post("includes/delete_admin.inc.php",{ checked_box : $('input:checkbox:checked').val()},function(json) {
if(json.result === "success") {
$("#deleteAdminError").html(json.message);
$("input:checkbox:checked").remove();
// $('.add_intern').get(0).reset();
}else{
$("#deleteAdminError").html(json.message);
}
});
});//submit click
The checkbox and label are dynamically created, and the only code I have found is for checkboxes and labels that are embeded in code with specific id that is easily identified, I hope that makes sense
Aucun commentaire:
Enregistrer un commentaire