Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 검색
- 아이오닉 스크롤 이벤트
- mysql if
- Oracle LISTAGG 사용 예시
- angular button
- ApexChart
- angular animation
- egov spring ajax 사용 예시
- scroll
- modal
- 스크롤 이벤트 감지
- angular route
- prisma
- 앵귤러 모달
- TAILWIND
- 셀렉트박스 커스텀
- 호버
- flex-1
- summary
- route
- 앵귤러 애니메이션
- Angular Router
- 옵저버블
- Router
- 스크롤 이벤트
- 모달
- ajax 사용 예시
- Ionic modal
- formgroup
- angular modal
Archives
- Today
- Total
깜놀하는 해므찌로
Egov Spring multi ajax 사용 예시 / ajax Promise 방식 / 이중 ajax 사용 예시 JavaScript 본문
IT
Egov Spring multi ajax 사용 예시 / ajax Promise 방식 / 이중 ajax 사용 예시 JavaScript
agnusdei1207 2022. 7. 6. 08:56반응형
SMALL
new Promise((succ, fail)=>{
$.ajax({
url: "./ajax1.php",
type: "POST",
dataType : "JSON",
success: function(result) { // 성공
succ(result.data);
console.log(result.data);
},
fail: function(result) { // 실패
fail(error);
console.log(result.data);
}
});
}).then((arg) =>{ // 두번째 ajax를 실행
$.ajax({
url: './ajax2.php',
type: 'post',
dataType : "JSON",
success: function(result2) { // 성공
succ(result2.data);
console.log(result2.data);
},
fail: function(result2) { // 실패
fail(error.data);
console.log(result.data);
}
});
});
1. 입력 및 수정 js 함수 선언
2. dataType : 리턴 받을 데이터 타입
3. success : 성공 시 다시 ajax 통신
4. 순서 promise 설정
5. 최종 성공 결과 : 리턴 받은 HMTL 타입의 data 를 class tbl 에 html 형식으로 리딩 후 붙이기
반응형
LIST
'IT' 카테고리의 다른 글
Egov Spring ajax json 사용 예시 / 비동기통신 JavaScript / Controller 사용 예시 (0) | 2022.07.06 |
---|---|
JavaScript enter 감지 사용 예시 / 엔터 감지 예시 (0) | 2022.07.06 |
Egov Spring 즐겨찾기 별 모양 구현 예시 (0) | 2022.07.06 |
JavasScript Cookie 쿠키 사용 예시 (0) | 2022.07.05 |
Egov Spring Controller Array 컨트롤러 배열 처리 (0) | 2022.07.05 |