In your controller you could return a json response instead like..
return ['redirect' => route('training_schedules.index')];
then
axios.post(this.baseUrl, this.$data).then(function (response) {
window.location = response.data.redirect;
});
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
hello iam trying to redirect to another page after submiting the form
in normal html in my controller iam using the following
return redirect()->route('training_schedules.index');
but this not working with vuejs
now in my view i have following
submitForm: function (e) {
console.log(this.$data);
axios.post(this.baseUrl, this.$data).then(function (response) {
console.log(response);
});
this.submitted = true;
},
so i want to redirect to the same route('training_schedules.index') if my response is ok
how i can do that
In your controller you could return a json response instead like..
return ['redirect' => route('training_schedules.index')];
then
axios.post(this.baseUrl, this.$data).then(function (response) {
window.location = response.data.redirect;
});
Please or to participate in this conversation.