: ajax를 이용하기 위해서는
jquery
가 필요하다
$.ajax({
url : url,
type : "POST",
data : JSON.stringify(json),
contentType : 'application/json;charset=UTF-8',
success: function (res) {
// Post 통신 성공시 로직
// res는 RestApi로부터 받은 데이터 (여기서는 json형식)
},
error : fucntion (res) {
// 에러시의 로직
}
});
data
: ajax에서 보내는 데이터dataType
: data
의 타입contentType
: 받아오는 데이터 타입