Code: Select all
jQuery(function ($) {
$('#confirm-dialog input.confirm, #confirm-dialog a.confirm').click(function (e) {
e.preventDefault();
// example of calling the confirm function
// you must use a callback function to perform the "yes" action
confirm("Are you sure you want to delete this notification?", function () {
window.location.href = $("a.confirm").attr("href");
});
});
});
function confirm(message, callback) {
$('#confirm').modal({
closeHTML: "<a href='#' title='Close' class='modal-close'>x</a>",
position: ["20%",],
overlayId: 'confirm-overlay',
containerId: 'confirm-container',
onShow: function (dialog) {
var modal = this;
$('.message', dialog.data[0]).append(message);
// if the user clicks "yes"
$('.yes', dialog.data[0]).click(function () {
// call the callback
if ($.isFunction(callback)) {
callback.apply();
}
// close the dialog
modal.close(); // or $.modal.close();
});
}
});
}
Code: Select all
<?php session_start();
include('../Connection/mysql_connect_notification.php');
$query="SELECT * FROM tb_notification WHERE Employee_No = '$_SESSION[u_name]' ORDER BY ID_No DESC";
$result=mysql_query($query);
while($row=mysql_fetch_array($result)) {
echo "<b>$row[3] $row[4]</b> <br/> $row[2]<br/>
<div id='content' style='background-color: white;'>
<div id='confirm-dialog'>
<a class='confirm' style='margin-left: 145px;' href='?delete=$row[0]' id='<?php echo $row[0]'>Delete</a><hr>";
echo "</div>";
}
?>