Answer the question
In order to leave comments, you need to log in
Ajax returns 3 arrays instead of 1?
Here is the code to select all checkboxes:
jQuery(document).ready(function($) {
$("#select_all").change(function () {
$("table input:checkbox").prop('checked', $(this).prop("checked"));
});
$(document).on('change', '.checkbox', function(event) {
var values = [];
$('input[type="checkbox"]:checked').each(function() {
if( $.isNumeric($(this).val()) ){
values.push($(this).val());
}
});
$(document).on('click', '.mass_delete', function( ) {
$.ajax({
url: '/deleter.php',
type: 'POST',
data: {
ids: values,
},
})
.done(function(response) {
alert(response);
console.log("Success!");
});
});
});
});
$ids = $_POST['ids'];
print_r($ids );
exit;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question