Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Deleting multiple rows in MySQL database using ajax and php Re: Deleting multiple rows in MySQL database using ajax and php

#127604
justinweb
Member

NEVERMIND!!! I just had to create an array and pass it to my delete.php file.

$(‘#post_list’).submit( function (e) {
e.preventDefault();

var postID = [];
$(“.select_post[name=’select_post[]’]:checked”).each(function () {
postID.push(parseInt($(this).val()));
});
alert(postID);

$.ajax({
type: ‘POST’,
url: ‘delete_post.php’,
data: { select_post : postID }
}).success( function () {
alert(‘deleted’);
});
});

Thanks to myself :P