I have a database structure with an one to many relationship. In the html form, there are similar inputs with a name \'item[]\' or \'file[]\' to make the data to be an array
var data = {};
$(function(){
$(document).on('change', 'input', function(){
data[this.name] = this.value;
});
});
You can add a change event to the inputs and add the changed values to the data object or append fields to form data. So data object with contain only the changed values.
You can use formdata for sending files data. Please refer the this link.
How to use FormData for ajax file upload