$.ajax({
type: 'POST',
url: '링크',
data: JSON.stringify(Data),
contentType:"application/json", //클라->서버
dataType:"json",// 서버->클라
success: function(res) {
console.log(res)
},
error : function(xhr,status,error) {
//오류 발생 시 처리
},
complete:function(data,textStatus) {
//작업 완료 후 처리
}
});
}
contentType 은 서버로 전송할때 보낼 데이터의 타입을 지정
dataType : 서버로부터 받을 데이터의 타입을 지정
반응형
'웹 개발 > 🌐 JavaScript' 카테고리의 다른 글
forEach시 null값처리 (0) | 2024.03.15 |
---|---|
자바스크립트에서 오디오 자동재생시 powerMonitoring.js:2198 Uncaught (in promise) DOMException: play() failed because the user didn't interact with the document first. https://goo.gl/xX8pDD 에러 (0) | 2023.12.25 |
암묵적 전역변수 (0) | 2023.06.23 |
es6+ | 자바스크립트의 한계와 Null (0) | 2023.05.29 |
es6+ | 객체 (1) | 2023.05.29 |