Confirm delete?

Confirm delete?

schnibitzschnibitz Posts: 15Questions: 0Answers: 0
edited February 2012 in General
Hi everyone, been trying to figure out the syntax for a confirm alert when someone clicks the "delete" button to delete rows in my table.

[code]
$('#delete_row').click( function () {
$.ajax( {
"url": "/delete_row.php",
"data": { "ids": selectedIds },
"dataType": "json",
"type": "post",
"success": function ()
[/code]

I've found a few examples of code that will do what I'm referring to, but I'm not sure how to fit them in to the above syntax. Any direction would be greatly appreciated.

-S

Replies

  • allanallan Posts: 63,397Questions: 1Answers: 10,451 Site admin
    Something like this would allow you to do the confirm:

    [code]
    $('#delete_row').click( function () {
    if ( confirm( "Are you sure you want to delete the selected rows?" ) ) {
    $.ajax( {
    "url": "/delete_row.php",
    "data": { "ids": selectedIds },
    "dataType": "json",
    "type": "post",
    "success": function () {...}
    } );
    }
    } );
    [/code]

    Allan
  • schnibitzschnibitz Posts: 15Questions: 0Answers: 0
    Perfect, thank you!
This discussion has been closed.