在用户确认下单的界面会遇到这种情况,使用jquery提交订单以后,直接跳转到订单信息页面或者新的下单页面
function(data){
if(data.erro = "0"){
Swal.fire({
type: 'success',
title: 'success',
text: 'order success',
}).then(function(){
window.location = "/panel.html";});
}else{
Swal.fire({
type: 'error',
title: 'Oops...',
text: data.ret,
})
}
}
data为jquery提交订单以后的返回信息
另外现在很多网站都加了cloudflare的cdn,可以使用这个的链接加载sweetalert2
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/11.4.3/sweetalert2.min.css" integrity="sha512-y4S4cBeErz9ykN3iwUC4kmP/Ca+zd8n8FDzlVbq5Nr73gn1VBXZhpriQ7avR+8fQLpyq4izWm0b8s6q4Vedb9w==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/11.4.3/sweetalert2.all.min.js" integrity="sha512-yY5lLK/FI06ec89MLXn5y8Vt2REftCFIMVahvH5wJ9+2odqDekjgOGd0A3rmEJktq7qCpM9SsT+zcqTgPKiYLw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>