Hi guys, so i have a table populated by event details from database and i use a checkbox to select which event to be deleted:
echo
"<tr>
<td><input type='checkbox' name='check[]' class='check' value='$id'>$name</a></td><td>$formatDate</td>
</tr>";
my delete function:
<?php
if(isset($_SESSION['sess_user_id']))
{
if(isset($_POST['del_event']) && isset($_POST['check']))
{
require "connection.php";
$userid = $_SESSION['sess_user_id'];
foreach($_POST['check'] as $del_id)
{
$del_id = (int)$del_id;
$sqlqueer = "DELETE FROM event WHERE event_id IN ($del_id) AND euser_id IN ($userid)";
$deletion = $dbh->query($sqlqueer);
if($deletion)
{
echo "<script type='text/javascript'>window.location.href='event.php';</script>";
}
}
}
}
?>
and it works fine. I wanna know how to call that delete function after a confirm dialog, something like this?
<script type="text/javascript">
$(".del_single_event").live("click", function(){
var r = confirm("Are you sure ?");
if(r)
{
$.ajax({
type: 'GET',
url: 'DelEvent.php',
data: //how do i get the data?
success: function(data){
alert("Deleted!");
}
)};
}
});
</script>
but how do i get the data?
TIA!