Hi,
I want to use the nice looking Sweetalert 2 Sweetalert in button code to open popup and ask for input from user.
I can succesfully use simple flavor of Sweetalert, but when i try to take input from user i need to use await inside the code and that makes the page render this fault: "Uncaught SyntaxError: await is only valid in async function"
From what i been able to find regarding this i need to declare the click handler function as async.
Is that possible in any way?
Example of code i'm trying to use on the "Client Before" of button:
const {value: email} = await swal({
title: 'Input email address',
input: 'email',
inputPlaceholder: 'Enter your email address'
})
if (email) {
swal('Entered email: ' + email)
}
Tried to add this before my code without any luck:
jQuery.ajaxSetup({async:true});
Anyone have any idea how to solve this?
/ Kristian