Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.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 重定向到其他页面后,如何保持toast bulma_Javascript_Ajax_Laravel_Bulma - Fatal编程技术网

Javascript 重定向到其他页面后,如何保持toast bulma

Javascript 重定向到其他页面后,如何保持toast bulma,javascript,ajax,laravel,bulma,Javascript,Ajax,Laravel,Bulma,从标题本身。是的,在页面重定向后,如何保持bulma祝酒词的活力?目前,我用bulma的toast保存数据的代码运行良好。但我试图实现的是在重定向后保持吐司 以下是我保存数据的ajax代码: $.ajax({ headers:{'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')}, url: "{{ route('payNow')

从标题本身。是的,在页面重定向后,如何保持bulma祝酒词的活力?目前,我用bulma的toast保存数据的代码运行良好。但我试图实现的是在重定向后保持吐司

以下是我保存数据的ajax代码:

$.ajax({
                        headers:{'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},
                        url: "{{ route('payNow') }}",
                        method: "POST",
                        data:{payNow: "TRUE"}, 
                        dataType: "json",
                        success:function(data)
                        {
                            if(data.success.length > 0){
                                // getDtls();
                                window.location = "//mydomain/reseller/transaction_history";
                                bulmaToast.toast({ message: data.success[0],
                                                   dismissible: true,
                                                   duration: 3000,
                                                   pauseOnHover: true,
                                                   animate: { in: "fadeIn", out: "fadeOut" },
                                                   type: "is-success" });
                            }else{
                                bulmaToast.toast({ message: data.error[0],
                                                   dismissible: true,
                                                   duration: 3000,
                                                   pauseOnHover: true,
                                                   animate: { in: "fadeIn", out: "fadeOut" },
                                                   type: "is-danger" });
                            }

                        },
                        error: function(xhr, ajaxOptions, thrownError){
                            console.log(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
                        }
                    });
如您所见,我首先对
窗口进行编码。在
Bulmotast
之前的位置
,期望web首先重定向并显示
toast
效果


toast显示成功,但由于重定向,toast的显示速度太快,因此无法正确显示toast,因为代码已开始转换到下一页。如果希望toast显示在下一页上,则需要在转换之前显示,或者在当前页上显示toast,并向window.location发出setTimeout回调