I have a form that sends the information to the controller by ajax.
When adding a record using type: POST if it works since doing dd ($ request-> all ()) shows me the array with the data.
function saveReg() {
var datos = new FormData();
datos.append('Date', $('#Date').val());
datos.append('file', $('input[type=file]')[0].files[0]);
$.ajax({
type: 'POST',
url: '{{url('/emp/newReg')}}',
data: datos,
contentType: false,
processData: false,
success: function (data) {
// location.reload();
},
error: function (data) {
console.log(data);
showAjaxErrors(data, 'error_msg');
markError(['Date', 'file']);
}
});
But using PUT method does not send the information to the control since doing dd ($ request- > all ()) shows me the blank array
function saveReg() {
var datos = new FormData();
datos.append('Date', $('#Date').val());
datos.append('file', $('input[type=file]')[0].files[0]);
$.ajax({
type: 'PUT',
url: '{{url('/emp/newReg')}}',
data: datos,
contentType: false,
processData: false,
success: function (data) {
// location.reload();
},
error: function (data) {
console.log(data);
showAjaxErrors(data, 'error_msg');
markError(['Date', 'file']);
}
});