From bbbb5f2ea854bdce4121a1d239a0492401e37030 Mon Sep 17 00:00:00 2001 From: SeoJin Kim Date: Fri, 7 Jan 2022 18:01:42 +0900 Subject: [PATCH] =?UTF-8?q?[Spring][=EC=87=BC=ED=95=91=EB=AA=B0=20?= =?UTF-8?q?=ED=94=84=EB=A1=9C=EC=A0=9D=ED=8A=B8][46]=20=EB=8C=93=EA=B8=80?= =?UTF-8?q?=20=EC=B2=B4=ED=81=AC=20-=202?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://kimvampa.tistory.com/292 --- .../main/webapp/WEB-INF/views/goodsDetail.jsp | 27 +++++++++++++++---- .../main/webapp/WEB-INF/views/goodsDetail.jsp | 27 +++++++++++++++---- 2 files changed, 44 insertions(+), 10 deletions(-) diff --git a/VamPa/src/main/webapp/WEB-INF/views/goodsDetail.jsp b/VamPa/src/main/webapp/WEB-INF/views/goodsDetail.jsp index ce08974..c56114f 100644 --- a/VamPa/src/main/webapp/WEB-INF/views/goodsDetail.jsp +++ b/VamPa/src/main/webapp/WEB-INF/views/goodsDetail.jsp @@ -314,12 +314,29 @@ const form = { const memberId = '${member.memberId}'; const bookId = '${goodsInfo.bookId}'; - let popUrl = "/replyEnroll/" + memberId + "?bookId=" + bookId; - console.log(popUrl); - let popOption = "width = 490px, height=490px, top=300px, left=300px, scrollbars=yes"; - - window.open(popUrl,"리뷰 쓰기",popOption); + $.ajax({ + data : { + bookId : bookId, + memberId : memberId + }, + url : '/reply/check', + type : 'POST', + success : function(result){ + if(result === '1'){ + alert("이미 등록된 리뷰가 존재 합니다.") + } else if(result === '0'){ + let popUrl = "/replyEnroll/" + memberId + "?bookId=" + bookId; + console.log(popUrl); + let popOption = "width = 490px, height=490px, top=300px, left=300px, scrollbars=yes"; + + window.open(popUrl,"리뷰 쓰기",popOption); + } + + } + }); + + }); diff --git a/VamPa_MySQL/src/main/webapp/WEB-INF/views/goodsDetail.jsp b/VamPa_MySQL/src/main/webapp/WEB-INF/views/goodsDetail.jsp index ce08974..c56114f 100644 --- a/VamPa_MySQL/src/main/webapp/WEB-INF/views/goodsDetail.jsp +++ b/VamPa_MySQL/src/main/webapp/WEB-INF/views/goodsDetail.jsp @@ -314,12 +314,29 @@ const form = { const memberId = '${member.memberId}'; const bookId = '${goodsInfo.bookId}'; - let popUrl = "/replyEnroll/" + memberId + "?bookId=" + bookId; - console.log(popUrl); - let popOption = "width = 490px, height=490px, top=300px, left=300px, scrollbars=yes"; - - window.open(popUrl,"리뷰 쓰기",popOption); + $.ajax({ + data : { + bookId : bookId, + memberId : memberId + }, + url : '/reply/check', + type : 'POST', + success : function(result){ + if(result === '1'){ + alert("이미 등록된 리뷰가 존재 합니다.") + } else if(result === '0'){ + let popUrl = "/replyEnroll/" + memberId + "?bookId=" + bookId; + console.log(popUrl); + let popOption = "width = 490px, height=490px, top=300px, left=300px, scrollbars=yes"; + + window.open(popUrl,"리뷰 쓰기",popOption); + } + + } + }); + + });