반응형
ajax 처리를 위해 코드를 작성하였는데 아래와 같은 에러 코드가 발생하였다.
$.ajax({
url:"/login/login",
type:"POST",
data:JSON.stringify(params),
contentType: "application/json",
success: function(result) {
if (result) {
alert("저장되었습니다.");
} else {
alert("잠시 후에 시도해주세요.");
}
},
error: function() {
alert("에러 발생");
}
})

원인: jquery 선언을 위에 안해주었기 때문에 발생
jquery cdn을 검색하여 코드에 추가해준다.
jQuery CDN
The integrity and crossorigin attributes are used for Subresource Integrity (SRI) checking. This allows browsers to ensure that resources hosted on third-party servers have not been tampered with. Use of SRI is recommended as a best-practice, whenever libr
releases.jquery.com

추가 후 에러가 발생하지 않는다.

반응형
'프론트엔드 > JavaScript' 카테고리의 다른 글
배열 함수 예제 (forEach, includes, indexOf, findIndex, find) (0) | 2024.07.28 |
---|---|
현재 브라우저 활성화 여부 체크 방법 (0) | 2024.04.04 |
datepicker 달력으로만 입력 가능, 초기화 버튼, 한글 표시 (0) | 2022.03.25 |
js 테이블 체크박스 데이터 한번에 전송하는 방법 - ajax로 배열 controller로 전송하여 VO에 담기 (0) | 2022.03.23 |
ajax예제 (0) | 2021.11.18 |