【发布时间】:2017-05-08 18:34:24
【问题描述】:
我有一个打开的支付模式,一旦用户填写它,如果支付成功,我想重定向到另一个页面,并显示成功消息。我使用 Laravel 5.3 和 Vue JS。
现在,这就是它的样子,我让它重定向到不同的页面,但我要如何附加某种成功消息?
this.$http.post('/cropkit/public/subscriptions', this.$data).then(
window.location.replace('/cropkit/public/profile/dashboard'),
response => this.status = response.body.status
);
/******** 编辑*********/
这是检查是否成功或发生错误的解决方案:
swal 是一个警报消息插件
this.$http.post('/mysite/subscriptions', this.$data).then((response) => {
swal({
title: "Success!",
text: "Payment has been processed!",
type: "success",
showConfirmButton: false,
allowEscapeKey: false,
allowOutsideClick: false,
timer: 5000,
}),
setTimeout(function(){
window.location.replace('/mysite/profile/dashboard');
}, 4000)
}, (response) => {
this.status = response.body.status
});
【问题讨论】:
标签: javascript laravel vue.js laravel-5.3 httpwebresponse