I have function in javascript (in client side) alertmemedium()
that call to an alert, which the client shpuld choose one option of two.
And I need that if he will click the OK button, The function RegisterUser()
(from code behind) will run, if the client will click the seconed button nothing will happened.
So even if I call RegisterUser()
in alertmemedium()
-- (like that <%RegisterUser();%>) -- in if condition the function from code behind ignore everything and just run by itself before it called. RegisterUser() written in code behind c#.
the js function:
function alertmemedium(){
const swalWithBootstrapButtons = Swal.mixin({
customClass: {
confirmButton: 'btn btn-success',
cancelButton: 'btn btn-danger'
},
buttonsStyling: false
})
swalWithBootstrapButtons.fire({
title: 'Are you sure?',
text: "Your Password has a medium strength!",
type: 'warning',
showCancelButton: true,
confirmButtonText: 'Yes!',
cancelButtonText: 'No, cancel!',
reverseButtons: true
}).then((result) => {
if (result.value) {
swalWithBootstrapButtons.fire(
'Well done!',
'You signed up to our website.',
'success'
)
this is the call to the cade behind function -- continue -->
<%RegisterUser();%>
} else if (
result.dismiss === Swal.DismissReason.cancel
) {
swalWithBootstrapButtons.fire(
'Cancelled',
'Improve Your Password!:)',
'error'
)
}
})
}