[英]Is there a way to keep signed in status after redirecting to another page?
[英]How do you keep toast bulma after redirecting to another page
从标题本身。 是的,在重定向页面后,如何保持布尔司面包? 目前,我的用于保存布尔加吐司数据的代码运行良好。 但是我要实现的目标是在重定向后保持举杯。
这是我保存数据的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);
}
});
如您所见,我首先在bulmaToast
之前对window.location
进行了bulmaToast
以期望网络将首先重定向并显示toast
效果。
吐司显示成功,但是由于重定向,吐司显示太快
由于代码已经开始过渡到下一页,因此无法正确显示吐司。 如果要在下一页上显示该吐司,则需要在过渡之前将吐司闪现到会话中 ,或者在window.location的setTimeout回调中在当前页面上显示该吐司。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.