How to display delete warning

<html><head><script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script src="/js/jquery.confirm.js" type="text/javascript">
</script>
<script language="javascript">
// load jquery here before calling this
$(document).ready(function() {

    // delete the entry once we have confirmed that it should be deleted
    $('.delete').click(function() {
		var parent = $(this).closest('tr');
		$.ajax({
			type: 'get',
			url: 'delete.php', // <- replace this with your url here
			data: 'ajax=1&#038;delete=' + $(this).attr('id'),
			beforeSend: function() {
				parent.animate({'backgroundColor':'#fb6c6c'},300);
			},
			success: function() {
				parent.fadeOut(300,function() {
					parent.remove();
				});
			}
		});	        
    });

    // confirm that it should be deleted
    $('.delete').confirm({
        msg:'Do you really want to delete this?',
        timeout:3000
    });		
});
</script></head></html>
<?php
require_once('upper.php');
if(isset($_COOKIE['AdminCookie'])){

require_once('database.php');
$query="select * from events ";
$result=mysqli_query($dbc,$query) or die('Not Connected');
while($row=mysqli_fetch_array($result)){
echo "<div id='delete'>";
echo "<a href='EventsDeleted.php?EventId=".$row['EventId']."'>".$row['Title']."</a><br><br>";
echo "<br></div>";
}
echo "<a href='log_out.php'>Admin Log out</a><br>";
echo "<a href='AdminHome.php'>Back to Admin Home</a>";
}

else{echo 'Sorry, This page is restricted.';}
require_once('lower.php');

In above code I want that when admin delete any event, there should an warning message prompt but my jquery not works…
Plz help…

It doesn’t look like you’ve loaded jQuery in that page. Have you?

I don’t understand
what you want to say???/

It doesn’t look like you’ve loaded jQuery in that page. Have you?

Here, I bolded the important words that might help you comprehend better :slight_smile:

Good point about not including jquery, although the OP might have it in the “jquery.confirm.js” script.

ankit, you’ve posted your thread twice. I posted a response in your other thread but I’ll copy it here so we can just do everything here.

You can’t do $(‘#delete’).confirm(…) because confirm is nothing to do with jQuery. Also, your code doesn’t seem to include any action to do if the confirmation was successful. So it was never going to work anyway - at most it would just show a message.

This is the problem with jQuery - people learn it before learning JavaScript and then the boundaries get blurred.

You need to just do something like this:

if (confirm('Do you really want to delete this?')) {
  // Yes, so go ahead
}
else {
  // No, don't delete
}

Try that and if it doesn’t work post what you attempted.