Spring

sweetAlert2 페이지 이동시 버튼 누를때 까지 대기하는 방법

콩이아부지이 2021. 12. 7. 20:53
728x90
Swal.fire({
icon: 'error',
title: '결제실패',
text: msg,	})

위코드 처럼 쓰면 다음줄에 location.href , reload 등을 했을때 alert을 보지못하고 바로넘어간다.

 

Swal.fire({icon: 'error',
title: '결제실패',
text: msg,	}).then(function(){
location.href='home';
})

 

뒷부분에 이렇게 붙여주면 버튼 누를때까지 안넘어간다.

728x90