This topic is locked
[SOLVED]

How to pass Sweet Alert Input to Server event?

3/17/2022 4:41:32 AM
PHPRunner General questions
U
ustunsoz author

Hey everyone,

I would like to use Sweet Alert to collect only one field entry with custom button, I can do it with Dialog api for sure but swal is more pretty. My problem is to pass data to server event.
I couldn't figure out how to get input value to params after swal input value entered. Is it possible ?

The input popup code is as follow :

swal("Write something here:", {
content: "input",
})
.then((value) => {
swal(`You typed: ${value}`);
});

What is the correct way to send value to params?

Sergey Kornilov admin 3/17/2022

For this kind of scenario you need to use Dialog API. It is specifically designed for this purpose and you can use some CSS to make it look different.