전송 타입 변경
This commit is contained in:
parent
5e4fe5f9b3
commit
d71663e0d6
|
|
@ -45,7 +45,7 @@ public class UserProfileController {
|
||||||
@Value("server.servlet.context-path")
|
@Value("server.servlet.context-path")
|
||||||
private String CONTEXT_PATH;
|
private String CONTEXT_PATH;
|
||||||
|
|
||||||
@PutMapping("/user/{id}")
|
@PostMapping("/user/{id}")
|
||||||
// public HashMap<String, Object> putUserProfile(@PathVariable String id, @RequestParam String name,
|
// public HashMap<String, Object> putUserProfile(@PathVariable String id, @RequestParam String name,
|
||||||
// public void putUserProfile(@PathVariable String id, @RequestParam String name,
|
// public void putUserProfile(@PathVariable String id, @RequestParam String name,
|
||||||
public List<UserProfile> putUserProfile(@PathVariable String id, @RequestParam String name,
|
public List<UserProfile> putUserProfile(@PathVariable String id, @RequestParam String name,
|
||||||
|
|
@ -121,7 +121,7 @@ public class UserProfileController {
|
||||||
// return map; //스프링이 자동으로 JSON타입으로 반환해서 전달한다.
|
// return map; //스프링이 자동으로 JSON타입으로 반환해서 전달한다.
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/user/{id}")
|
@PutMapping("/user/{id}")
|
||||||
public void postUserProfile(@PathVariable String id, @RequestParam String name,
|
public void postUserProfile(@PathVariable String id, @RequestParam String name,
|
||||||
@RequestParam String phone, @RequestParam String address, @RequestParam String filepath) {
|
@RequestParam String phone, @RequestParam String address, @RequestParam String filepath) {
|
||||||
mapper.updateUserProfile(id, name, phone, address, filepath);
|
mapper.updateUserProfile(id, name, phone, address, filepath);
|
||||||
|
|
|
||||||
|
|
@ -6,24 +6,51 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>Insert title here</title>
|
<title>Insert title here</title>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
$(document).ready(function(){
|
||||||
|
$("#buttonSubmit").on('click',function(){ // 제출 버튼 이벤트 지정
|
||||||
|
$.ajax({
|
||||||
|
url: "https://api.leejk0523.com/profile/user/10", // 목적지
|
||||||
|
async: true,
|
||||||
|
type: "POST", // HTTP Method
|
||||||
|
data: $("#theForm").serialize(), // 전송 데이터
|
||||||
|
dataType: "text", // 전송 데이터 형식
|
||||||
|
success: function(result, status){ // 성공 시 실행
|
||||||
|
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) { //실패 시 실행
|
||||||
|
console.log("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error);
|
||||||
|
alert("실패 원인 : " + error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<a href="/profile/addItem?id=aaaaa">aaaaaaa</a>
|
<!-- <a href="/profile/addItem?id=aaaaa">aaaaaaa</a> -->
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
<form action="addItem" method="get">
|
<form id="theForm" method="post" enctype=”multipart/form-data”>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="50%">ID </td>
|
<td>ID <input type="text" name="id" size="50"/><br></td>
|
||||||
<td><input type="text" name="id" size="50"/></td>
|
<td><input type="file" multiple="multiple" name="fileob"></td>
|
||||||
</tr>
|
<td><input id="buttonSubmit" type="submit" value="Send"/></td>
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td colspan="2" align="center"><input type="submit" value="Send"/></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue