let form = $(this).closest('#document-credit-form');
let data = new FormData(form[0]);
if(Object.keys(imageArray).length){
for (key_1 in imageArray) {
for (key_2 in imageArray[key_1]) {
data.append('document_credit[item]['+key_1+'][images]['+ key_2 +']', imageArray[key_1][key_2]);
}
}
}