ferdinandfrank / vue-forms

Set of Vue.js components to submit forms with ajax.
https://ferdinandfrank.github.io/vue-forms/
MIT License
5 stars 0 forks source link

Redirect Issue #5

Closed pieinn closed 6 years ago

pieinn commented 6 years ago

In my controller i have function redirect to . ... but when i use not redirect? Please advice how to resolve this issue. Thanks!

ferdinandfrank commented 6 years ago

That's because the form components expect the response to be in a JSON format. As stated here, you can control the handling after the form was processed by the server by specifying specific keys in the JSON response. If you want to redirect the user after the form was processed you need to return the following JSON data with the key redirect and your redirect url as the value in your controller method:

return response()->json([
    'redirect' => route('home') 
]);
pieinn commented 6 years ago

Thank you, I understood how it works!

But redirect to back, not to my home page:

`return response()->json([
    'redirect' => route('home') 
]);`

Sorry, I'm newbie...

pieinn commented 6 years ago

All works thank you!