loading block content using ajax

I am looking for steps to load a block content using ajax. I am able to create a block but can't figure how to fire a request from this block using cs-cart ajax functions and get html content from a controller

In other words, what code should go in the tpl rendered in the initial load that will fire a request to my controller and what specifc code do I need to put in my controller to return html response as JSON

I have tried to search around and follow the below post but no avail

Based on this post - http://forum.cs-cart…cts-using-ajax/,

[color=#282828][font=arial, verdana, tahoma, sans-serif]Thanks![/font][/color]

To use a separate controller or mode you will need to do a regular Javascript (or jQuery) ajax request to your controller/mode and then do a DOM innerHtml() to insert your results.

If you're using the same controller mode but just want to update based on changes, look at the templates for 'price' and 'quantity'. When quantity is changed it does an ajax request to get the current price block.

Thanks for the response! was able to figure this one out. I used the loadAjaxContent javascript method in the initial tpl and used $ajax->assign_html method from the controller to return ajax response.


Hi guys I would like to understand wich method you use to change a bloc content. In my case I create a block by create one with list and owl-carrousel I success to get data when I change and select an item in list bloc but I would to know the best to change my content caroussel of course I use a product_data.tpl and a template like grid_list.tpl ? How I could get data and template in my function to simply them assembled as my answer. Then If succeed with this I could pass directly data to owl-carrousel…

Thanks for your help