Skip to content

Commit

Permalink
Merge pull request #5 from SuperTapok/develop
Browse files Browse the repository at this point in the history
fix: 🐛 Fixed images uploading while product adding and editing
  • Loading branch information
SuperTapok authored Jan 1, 2024
2 parents f0b321a + 3501085 commit 8dbd113
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion public/js/product/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ $(document).ready(function () {

$("#form").submit( (e) => {
e.preventDefault();
var form_data = $("#form").serialize();
form_data = new FormData($("#form")[0]),
$.ajax({
type: "POST",
url: "/api/catalog/add_product",
data: form_data,
processData: false,
contentType: false,
success: function () {
modalText.innerHTML = 'Товар добавлен!';
},
Expand Down
4 changes: 3 additions & 1 deletion public/js/product/edit.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
$("#form").submit( (e) => {
e.preventDefault();
var form_data = $("#form").serialize();
form_data = new FormData($("#form")[0]),
$.ajax({
type: "POST",
url: "/api/catalog/edit_product",
data: form_data,
processData: false,
contentType: false,
success: function () {
modalText.innerHTML = 'Товар изменён!';
},
Expand Down

0 comments on commit 8dbd113

Please sign in to comment.