Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

how to get a part of the Volt template (and data) from AJAX?

Hello everyone! Recently began writing project on this framework, and met one small problem: I want to learn how you can get the data from the model processed by the Volt.

For example javascript:

$.ajax({ type: 'POST', data: {visible: mode, user_id: user}, success: function(data){

For example, in the fatfree framework, you can just call like this:

echo Template::instance()->render('system/result.html');



2.5k
Accepted
answer
edited Dec '14

If what you mean is get the html result from the view engine inside your controller, try this:

//Render all the view hierarchy related to the view system/result.html
$this->view->render("<controller>", "<action>");

//Finish the output buffering
$this->view->finish();

echo $this->view->getContent();

Hope that help...



878