add.jsp 수정
This commit is contained in:
parent
d71663e0d6
commit
1efd16f1ac
|
|
@ -48,15 +48,6 @@ public class JSPController {
|
||||||
return "add";
|
return "add";
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/addItem")
|
|
||||||
public void addItem(HttpServletRequest request) {
|
|
||||||
|
|
||||||
String id = request.getParameter("id");
|
|
||||||
System.out.println( id );
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/index.do")
|
@GetMapping("/index.do")
|
||||||
public String index(Model model) {
|
public String index(Model model) {
|
||||||
|
|
|
||||||
|
|
@ -8,29 +8,19 @@
|
||||||
<title>Insert title here</title>
|
<title>Insert title here</title>
|
||||||
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js" ></script> <!--jQuery 불러오기-->
|
<script src="http://code.jquery.com/jquery-3.4.1.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
$("#buttonSubmit").on('click',function(){ // 제출 버튼 이벤트 지정
|
$('#add').on('click', function(){
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "https://api.leejk0523.com/profile/user/10", // 목적지
|
url: "/user/10",
|
||||||
async: true,
|
type: "POST",
|
||||||
type: "POST", // HTTP Method
|
data: $('#theForm').serialize(),
|
||||||
data: $("#theForm").serialize(), // 전송 데이터
|
success: function(data){
|
||||||
dataType: "text", // 전송 데이터 형식
|
//location.href="listUser.do";
|
||||||
success: function(result, status){ // 성공 시 실행
|
alert("신규등록 OK");
|
||||||
console.log("성공');
|
|
||||||
console.log(data.status);
|
|
||||||
alert(result);
|
|
||||||
|
|
||||||
//$("#result_name").html(res.name);
|
|
||||||
//$("#result_ph_number").html(res.ph_number);
|
|
||||||
//$("#result_address").html(res.address);
|
|
||||||
},
|
},
|
||||||
error:function(equest, status, error) { //실패 시 실행
|
error: function(error){ alert(error); }
|
||||||
console.log("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error);
|
|
||||||
alert("실패 원인 : " + error);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -48,9 +38,11 @@
|
||||||
<form id="theForm" method="post" enctype=”multipart/form-data”>
|
<form id="theForm" method="post" enctype=”multipart/form-data”>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>ID <input type="text" name="id" size="50"/><br></td>
|
<td>Name <input type="text" id="name" name="name" value="50"/><br></td>
|
||||||
<td><input type="file" multiple="multiple" name="fileob"></td>
|
<td>Phone <input type="text" id="phone" name="phone" value="50"/><br></td>
|
||||||
<td><input id="buttonSubmit" type="submit" value="Send"/></td>
|
<td>Address <input type="text" id="address" name="address" value="50"/><br></td>
|
||||||
|
<td>File<input type="file" multiple="multiple" id="upfile"></td>
|
||||||
|
<td><input id="add" type="button" value="Send"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue