user7678643
user7678643

Reputation:

Laravel route after post in same page ""

We are using Laravel, we have a form post on the "/",

$router->get('/', 'AppController@show');

The form is a script that appear through a modal window, once we post the form it uses route:

$router->post('/', 'AppController@store');

and function

public function store()
{
    return view('app');

}

How we can stay on page without any return action after the post ?

With the current method it reloads the "/" page,

Are there a way to keep the "/" page as it is without reloading after the submit button?

Apologise for my english, i hope you understand our issue.

Thanks in advance,

Upvotes: 1

Views: 871

Answers (1)

Ferdie De Oliveira
Ferdie De Oliveira

Reputation: 581

You will need to make an ajax call to that resource. You can do with with plain javascript or you can use jQuery for this. $.post('/').

Dependant on your version, version 5.4 has a covenant axios.post method that you can use with Vue to send your ajax requests.

For a simple app jQuery may be the best simple option for you.

Upvotes: 0

Related Questions