Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/373.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/281.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 当我使用Ajax时,sweet Alert不会';不显示图像。I';我和拉威尔一起工作_Javascript_Php_Ajax_Laravel_Sweetalert - Fatal编程技术网

Javascript 当我使用Ajax时,sweet Alert不会';不显示图像。I';我和拉威尔一起工作

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

当我使用Ajax时,sweet Alert不会显示图像。我和拉威尔一起工作

这是我的代码,如果我删除ajax函数,或者我使用另一个网站上的图像,它就会工作

我真的不知道,我认为laravel需要通过Ajax请求进行某种身份验证。请帮帮我

 $(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时,它可以正常工作