jQuery Still Submits Ajax Post Even When “Cancel” is clicked on Confirm Dialog
问题 I have the following script I use for deleting users. The script works if I confirm that I want to delete the user but if I choose to cancel, the script still processes the ajax submission and deletes the user. I thought by setting an empty else{} statement would act as "do nothing" but apparently I was wrong there. $("#user_delete_submit").click(function(){ var dataString = $("#frm_user_delete").serialize(); if(confirm("This cannot be undone, are you sure?")){ $.ajax({ type: "POST", url: "