I want load views from controllers to the default layout without refreshing the default layout content in my cakephp site.
<div id="content" class="wrapper">
<?=$content_for_layout;?>
</div>
i am rendering views in to there is headers and footers in the content of the layout. i don't want to refresh that content while rendering views to the layout from controllers.
Use Ajax to update content of views.
For example you have id="content" in which you have view data, so update this div accoringly
For jQuery post request: http://api.jquery.com/jquery.post/
For jQuery get request: http://api.jquery.com/jquery.get/
Update you div as $( ".content" ).html( data ); // data is your html code
In your controller action
check request type and render their respective view and exit.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.