LARAVEL: Upload views without refresh from a fixed menu

Asked

Viewed 658 times

0

What is the best way to implement a system in Aravel, where when clicking a menu the views are loaded without refresh of the page, just update the content of "content". How can I implement this correctly in the Standard? Because I need to load different tables without refresh and fill them with ajax, but I don’t know if I can use the controller to open the views or use jquery ajax for this.

  • You can use Ajax with Controller and Views without problems. Correct way is complicated to say, if you have any minimal example that we can see?

  • I don’t have it, I only have the layout. How can I call the Controller by clicking on the menu and without refreshing the page?

1 answer

1

The best way to do this is by working with a reactive framework that enables you to work on your front as a SPA (Single Page Application).

The Laravel already comes with Vue.js as the "embedded" framework for this task.

What you’ll need to do is configure your application to use a web route as your SPA entry-point and then work on the front end application as a Vue.js application.

This way, you can use Vue-router to route the views, which will be components loaded on a specific part of your page, making you gain a lot of flexibility in content generation.

If you don’t know anything about SPA, I suggest looking for good articles on the web (usually in English).

I hope I’ve helped.

PS: I’ve used a lot jQuery throughout my life, today I run away, even more after the advent of ES5, 6 and 7.

Hugs.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.