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
- rsync
- git
- 인터페이스
- 자바
- IntelliJ
- SQL
- 추상클래스
- 오블완
- 명령어
- oracle
- group by
- MongoDB
- mssql
- spring
- docker
- analytics4
- 티스토리챌린지
- 리눅스
- java
- 호이스팅
- MariaDB
- JPA
- top
- PostgreSQL
- 트랜잭션
- Javascript
- Linux
- 차이점
- DBMS
Archives
- Today
- Total
hanker
Swal - Cannot read property 'then' of undefined 오류 본문
반응형
내가 작성한 코드는
$.ajax({
url : '../home/fileDown',
type: 'post',
data: data,
dataType : 'json',
success: function(rs){
HOME.hideLoadingBar();
swal({
title: "다운로드가 완료되었습니다.",
icon : "success",
closeOnClickOutside: false
}).then(function(){
});
}
});
파일다운로드가 완료되면 로딩바가 사라지고, Swal창을 통해 다운로드 확인을 한다.
close 버튼을 누르면 함수를 실행시키기 위해 then을 썻지만 계속해서
Cannot read property 'then' of undefined 오류가 뜬다..
swal 라이브러리 버전이 1.x.x 버전은 then으로 쓰면 오류가 난다.
2.x.x 버전부터는 오류가 나지 않는다.
아.. 내 시간..
$.ajax({
url : '../home/fileDown',
type: 'post',
data: data,
dataType : 'json',
success: function(rs){
HOME.hideLoadingBar();
swal({
title: "다운로드가 완료되었습니다.",
icon : "success",
closeOnClickOutside: false
}, function(){
console.log("해결!");
});
}
});
1.x.x 버전은 이렇게 쓰면된다!
반응형
'JavaScript' 카테고리의 다른 글
JQuery - Ajax 새로고침 문제 (0) | 2021.10.11 |
---|---|
SWAL - 닫기 버튼 클릭 시 이벤트 처리 (0) | 2021.02.04 |
JQuery - 선택자에 변수 넣기 (0) | 2020.12.16 |
JS - github api를 사용하여 git commit.message 불러오기 (0) | 2020.11.10 |
JavaScript - DataTables 파일 다운로드 (0) | 2020.10.05 |