Feature request from paales, posted on GitHub Jun 28, 2014
Related to #322 and #82.
The idea is that it should be possible to load a certain block (cart, toplinks, wishlist block) without creating a controller, with a nice Javascript API that is scalable for frontend developers.
As @kandy metioned, it is already possible to load certain blocks (although, that seems to have been build for the pagecache, not partial reloads), but I couldn't find a proper JS library to achieve this.
This issue focusses on the JS API.
We have created such a solution for our own needs: https://github.com/ho-nl/Ho_AjaxCart
In short, We have an action source:
<a href="#" data-ho-ajax-link="cart">foo</a>
And have target:
<div data-ho-ajax="<?php echo $this->getNameInLayout(); ?>" data-ho-ajax-group="cart">
...
</div>
When the action is called, the target is reloaded without reloading the complete page.
This solution works well for us, allows us to create fully ajax-reloaded pages. For example: The cart page allows you to clear an item from your cart an it reloads the products table, totals, shipping costs and the cart header. When someone estimates their shipping the shipping block is reloaded and the totals, but the products table.
Something like this would be really handy if it were in the core and would greatly improve compatibility with modules.