I want to add another item to formData.serializeArray() and send formData with ajax to laravel controller. Here is what I have tried:
var formData = $('#form').serializeArray();
formData.push({"name":"inputValue", "value": '1' });
$.ajax({
url: 'url',
type:"POST",
data: formData,
dataType : 'json',
cache: false,
success: function (data) {
}
})
In jquery, data pushed correctly. but, it doesn't send pushed data with ajax . it just send form data without new item.
Why it doesn't send pushed data with ajax?