Loading blocks / area's with ajax
Permalink
Hi all,
I am trying to load content from other page's to the .page div on the current page with Ajax. This can bee simply done with the $.load but of course the assets (css, js) from the block are not included this way.
I have also tried to load the area via the controller of the page type. it returns the date but still not assets.
How can I make sure that via an ajax call the blocks are getting loaded in the current page area with the assets?
Thanks,
Rge
I am trying to load content from other page's to the .page div on the current page with Ajax. This can bee simply done with the $.load but of course the assets (css, js) from the block are not included this way.
I have also tried to load the area via the controller of the page type. it returns the date but still not assets.
//hardcoded the id's for now public function load_area_blocks($area = 'page-477', $pageID = 477) { //get blocks from the main-content area $blocks = Page::getByID($pageID)->getBlocks('main-content'); $outputArea = Page::getCurrentPage()->getArea($area); $outputArea->disableControls(); $outputArea->display(Page::getCurrentPage(), $blocks); exit; }
How can I make sure that via an ajax call the blocks are getting loaded in the current page area with the assets?
Thanks,
Rge
There was this add-on in 5.6:https://www.concrete5.org/marketplace/addons/blocks-by-ajax/...
Maybe if you study it's code you get an answer.