Skip to content
This repository has been archived by the owner on May 31, 2024. It is now read-only.

Commit

Permalink
edit logic for update-product page
Browse files Browse the repository at this point in the history
  • Loading branch information
bakaqc committed Mar 6, 2024
1 parent 2847994 commit 48214f5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)

Singleton.productDAO.save(product);

response.sendRedirect("./product");
response.sendRedirect("./product-detail?id=" + idP);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ $(document).ready(function () {
e.preventDefault();

var formData = new FormData(this);

var productId = formData.get('id');

$.ajax({
type: 'POST',
Expand All @@ -20,11 +22,11 @@ $(document).ready(function () {
if (result.dismiss === Swal.DismissReason.timer) {
console.log('I was closed by the timer')
}
window.location.href = 'product';
window.location.href = 'product-detail?id=' + productId;
});

setTimeout(function () {
window.location.href = 'product';
window.location.href = 'product-detail?id=' + productId;
}, 1500);
},
error: function (response) {
Expand Down
10 changes: 5 additions & 5 deletions src/main/webapp/view/jsp/management/customer/customer-detail.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@
<div class="mb-3"><label class="form-label" for="country"><strong>Email</strong></label>
<input class="form-control" type="text" id="country" placeholder="${requestScope.cus.email}" name="country" readonly="">
</div>

<button class="btn btn-primary btn-sm" type="button">
<a class="back" href="<%=request.getContextPath()%>/customer" style="color: white; text-decoration: none;">Quay lại</a>
</button>

<a class="back" href="<%=request.getContextPath()%>/customer" style="color: white; text-decoration: none;">
<button class="btn btn-primary btn-sm" type="button">
Quay lại
</button>
</a>
</div>
</form>
</div>
Expand Down

0 comments on commit 48214f5

Please sign in to comment.