I have a payment modal that opens up, once the user fills it out, and if the payment is successful, I want to redirect to a different page, with a success message. Im using Laravel 5.3 and Vue JS.
Right now, this is how it looks like, and I got it to redirect to a different page, but how would I attach some sort of success message?
this.$http.post('/cropkit/public/subscriptions', this.$data).then(
window.location.replace('/cropkit/public/profile/dashboard'),
response => this.status = response.body.status
);
/******** EDIT *********/
Here is the solution to check if is successful, or error occurred:
swal is a alert message plugin
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
});
You could use the error callback.