There is jquery code with two post requests, the first processes the form, the second files. How to make everything go in one post request?
//Π‘ΠΎΡ
ΡΠ°Π½Π΅Π½ΠΈΠ΅ ΡΡΡΠ°Π½ΠΈΡΡ $j('.save').click(function (e) { var cont = $j('.edit').serialize(); $j.ajax({ type: 'POST', url: 'edit.php', dataType: 'html', data: cont, success: function (response) { $j(".result-files-upload").html(response); // Π€Π°ΠΉΠ» Π·Π°Π³ΡΡΠΆΠ΅Π½ $j(".result-files-upload").fadeIn(); setTimeout(function () { $j(".result-files-upload").fadeOut() }, 1500); }, error: function (xhr, str) { alert('ΠΠΎΠ·Π½ΠΈΠΊΠ»Π° ΠΎΡΠΈΠ±ΠΊΠ°: ' + xhr.responseCode); } }); var inp = $j('input[name="editimg"]').val(); if (inp == "yes") { var formData = new FormData($j(".sendfileform")[0]); $j.ajax({ url: 'edit.php', //ΠΊΡΠ΄Π° ΠΎΡΠΏΡΠ°Π²ΠΈΡΡ Π΄Π°Π½Π½ΡΠ΅ type: 'POST', data: formData, cache: false, dataType: 'html', processData: false, contentType: false, success: function (response) { $j(".result-files-upload").html(response); // Π€Π°ΠΉΠ» Π·Π°Π³ΡΡΠΆΠ΅Π½ $j(".result-files-upload").fadeIn(); setTimeout(function () { $j(".result-files-upload").fadeOut() }, 1500); } }); } });