ajax request in sweet alert I show to user a sweet alert after sending the activation code...This sweet alert has an input that the user must enter received code and send in the ajax request,
how i can do this?
swal({
title: 'enter confirmation code',
input: 'text',
inputPlaceholder: 'confirmation code',
showCancelButton: true,
inputClass: 'form-control',
inputValidator: function (value) {
return !value && 'You need to write something!'
}
}).then(function (result) {
if (result.value) {
swal({
type: 'success',
html: 'code, ' + result.value
});
}
});
in your then()
if (result.value) {
// do your ajax call
$.ajax({
// set your ajax settings....
// ajax was successful, display success swal
success: function(response) {
swal({
type: 'success',
html: 'code, ' + result.value
});
}
});
}
I assume you know how to set up your ajax call?
http://api.jquery.com/jquery.ajax/
@CRONIX - thanks bro, how can i get input value (in sweet alert)?
Please sign in or create an account to participate in this conversation.