0
I wish that when finding the data the sweetalert2 closed the modal.
But it returns nothing in . then
Here is my code:
swal({
title: 'Auto close alert!',
html: 'I will close in <strong></strong> seconds.',
onOpen: () => {
var ano = $('.slt-ano').val()
swal.showLoading()
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN' : $('meta[name="csrf-token"]').attr('content')
}
})
return $.ajax({
url : '{{ route('medicao.getDadosToGrapsh') }}',
type: 'post',
dataType: 'json',
data: {
ano : ano
}
}).done((r)=>{
return r
})
},
}).then((result) => {
console.log( result )
if (
// Read more about handling dismissals
result.dismiss === swal.DismissReason.timer
) {
console.log('I was closed by the timer')
}
})
How do I return the data in . then to close the modal?
Ball show...
– Gato de Schrödinger