Javascript 当我使用Ajax时,sweet Alert不会';不显示图像。I';我和拉威尔一起工作
当我使用Ajax时,sweet Alert不会显示图像。我和拉威尔一起工作 这是我的代码,如果我删除ajax函数,或者我使用另一个网站上的图像,它就会工作 我真的不知道,我认为laravel需要通过Ajax请求进行某种身份验证。请帮帮我Javascript 当我使用Ajax时,sweet Alert不会';不显示图像。I';我和拉威尔一起工作,javascript,php,ajax,laravel,sweetalert,Javascript,Php,Ajax,Laravel,Sweetalert,当我使用Ajax时,sweet Alert不会显示图像。我和拉威尔一起工作 这是我的代码,如果我删除ajax函数,或者我使用另一个网站上的图像,它就会工作 我真的不知道,我认为laravel需要通过Ajax请求进行某种身份验证。请帮帮我 $(document).ready(function() { $('.confirmation').click(function(e) { e.preventDefault(); // Prevent the href from r
$(document).ready(function() {
$('.confirmation').click(function(e) {
e.preventDefault(); // Prevent the href from redirecting directly
var linkURL = $(this).attr("href");
warnBeforeRedirect(linkURL);
});
function warnBeforeRedirect(linkURL) {
swal({
title: "Are you sure?",
text: "Once deleted, you will not be able to recover this team!",
icon: "warning",
buttons: true,
dangerMode: true,
})
.then((willDelete) => {
if (willDelete) {
swal({
title: "Checking...",
text: "Please wait",
icon: icons,
button: false,
allowOutsideClick: false
});
$.ajax({
url: linkURL,
type: 'GET',
success: function(result){
swal("The team was deleted!");
}
});
} else {
swal("The team was NOT deleted!");
}
});
}
});
可变图标在视图中声明如下
var icons='{{URL::asset('/icons/loading.gif')}}'代码>您是否检查了图像的url是否返回img?因为如果没有,它与SweetAlert没有任何关系是的,我甚至在网站@GaimZzI checked sweet alert文档中使用了它,从来没有说过你可以使用自定义url img来设置你想要的图标,所以这可能是问题所在,当我不使用Ajax时,它可以正常工作