我正在使用laravel 5和sweet alert2 在这段代码中,必须将数据发送到指定的路由...如果请求成功,它将显示相关消息,但是当我单击send时,什么也没有发生,只显示了空警报
jQuery(document).ready(function() {
jQuery('#rejectDoc').on('click', function(e) {
e.preventDefault();
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
swal({
title: 'Reasons for refusing documents',
input: 'textarea',
inputPlaceholder: 'typing...',
inputClass: 'form-control',
showCancelButton: true,
confirmButtonText: 'send',
showLoaderOnConfirm: true,
preConfirm: (textarea) => {
jQuery.ajax({
url: "{{ route('admin.auth.document.update' , [$document->id]) }}",
method: 'PATCH',
dataType: 'json',
data: {
_method: "PATCH",
actionCode: 0,
description: textarea
},
});
},
allowOutsideClick: false
}).then((result) => {
if (result.value) {
swal({
type: result.type,
title: result.msg,
});
}
});
});
});
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@8.2.6/dist/sweetalert2.all.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>