[JS] Ajax Post form data - fourslickz/notes GitHub Wiki
function postData(ids)
{
let formData = {
ids: ids,
};
$.ajax({
url: url + "/ajax/endpoint",
headers: {
'X-CSRF-TOKEN': token,
},
type: 'post',
data: formData,
success: function( response, textStatus, xhr ) {
console.log(xhr);
console.log(response);
},
error: function( xhr, textStatus, errorThrown ){
let response = JSON.parse(xhr.responseText);
Swal.fire({
title: errorThrown,
text: response.data,
icon: 'warning',
confirmButtonColor: '#556ee6'
});
}
}).done(function(xhr){
});
}