Developer forum

Forum » Rapido » JSON Avoid Dublication of fetching data

JSON Avoid Dublication of fetching data

Daniel Hollmann
Reply

Hi.

I maintain a DW, solution where I have to do some adjustments to a rapido template that fetches JSON data.

I have followed the example from the documentaion: https://doc.dynamicweb.com/rapido/development/development/rapido-javascript-ajax 
and I can get my stuff to work however, I need my json data in two diffrent divs.

Basically my code looks like this:

<div id=”ProductContainer” class=”js-handlebars-root” data-template=”MyProduct” data-json-feed=”/Default.aspx?ID=52&feed=true” data-pre-render-template=”ProductPreRender” data-preloader=”overlay”>

...... {Lot of Other Content} ......

<div id=”ProductContainer” class=”js-handlebars-root” data-template=”MyDataTemplate” data-json-feed=”/Default.aspx?ID=52&feed=true” data-pre-render-template=”ProductPreRender” data-preloader=”overlay”>

The problem with this solution is that i'm fetching the data, with the "data-json-feed" twice, which is bad practice. So a simple question. Can I re-use the JSON feed without
having to refactor the whole file?

 

Thanks!

 

 

 

 

 

 

 

 

 


Replies

 

You must be logged in to post in the forum