Skip to content
Advertisement

Sweet Alert 2 Yes/No – How to integrate a function for PHP?

I use Sweet Alert 2 for nice dialogs.

Now I want to use it for a security question if an database entry should be delete or not. It’s no problem to show the dialog, but I can’t find a way to integrate a function if the delete is confimred. Could anyone please help me?

Thats the code for now:

JavaScript

Advertisement

Answer

You could submit a form using JS which submits to the PHP file where your function is.

HTML:

JavaScript

yourphpfile.php:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement