Insert a view from a Composer method that is invoked via AJAX in Sage 10

From an AJAX function I want to invoke a method of a Composer, so far so good.

In the method, I make a get_posts() call and I want a partial view (which in turn contains a Blade component) with the retrieved posts to be returned as a response to the AJAX call.

Can this be done in Sage 10?

Thank you very much.

Place this in your file:

use function Roots\view;

and in your AJAX function:

echo view('partials.name-of-your-partial')->render();

Thank you very much for your help, Carlos!

1 Like