I'm working with Ajax in Laravel, Whenever Ajax is called the input fields values(which are empty string) are converted into null value. But I want empty string in response. How can I get this? I know I can map these values and convert/set null values to empty string but it is not efficient.
My Ajax Code:
$('#settingsForm').on('submit',(e) => {
e.preventDefault();
$.LoadingOverlay("show");
const id = $('#id').val();
const data = new FormData($('#settingsForm')[0]);
$.ajax({
type:'POST',
url: "{{url('company/settings')}}"+'/'+id,
processData: false,
contentType: false,
data: data,
beforeSend: ()=>{
console.log(data);
},
success: (resp) => {
if(resp.code == 200){
toastr.success(resp.type,resp.msg);
}else
toastr.error(resp.type,resp.msg);
$.LoadingOverlay("hide");
}
});
$('#tableRow').show();
$('#settingsDiv').hide();
})