This repository has been archived by the owner on May 31, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #155 from hardingadonis/chuong-fix-bug-143-144
Fixed bug 143 & 144
- Loading branch information
Showing
5 changed files
with
70 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/main/webapp/view/assets/js/management/product/update-product.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
$(document).ready(function () { | ||
$('#update-product').on('submit', function (e) { | ||
e.preventDefault(); | ||
|
||
var formData = new FormData(this); | ||
|
||
var productId = formData.get('id'); | ||
|
||
$.ajax({ | ||
type: 'POST', | ||
url: $(this).attr('action'), | ||
data: formData, | ||
processData: false, | ||
contentType: false, | ||
success: function (response) { | ||
Swal.fire({ | ||
title: 'Thành công!', | ||
text: 'Cập nhật sản phẩm thành công', | ||
icon: 'success', | ||
timer: 1500 | ||
}).then((result) => { | ||
if (result.dismiss === Swal.DismissReason.timer) { | ||
console.log('I was closed by the timer') | ||
} | ||
window.location.href = 'product-detail?id=' + productId; | ||
}); | ||
|
||
setTimeout(function () { | ||
window.location.href = 'product-detail?id=' + productId; | ||
}, 1500); | ||
}, | ||
error: function (response) { | ||
|
||
} | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters