Using jQuery tmpl in Wordpress and problem with ${ data} placeholder

36 Views Asked by At

I am going to use jQuery.tmpl on the WordPress page. Everything is going well until I apply the template over JSON Array. My problem is with placeholders. WordPress doesn't recognize the $ sign and iteration doesn't render ${placeholder}.

Do you have any suggestions?

This is the code:

<script id="brokersTemplate" type="text/x-jQuery-tmpl">
  <div class="data"> ${itemId} </div>

</script>
<div id="brokerResolve"></div>

<script>

jQuery(window).on('load',function(){
    jQuery.getJSON('data.json', function(jd) {
      jQuery('#brokersTemplate').tmpl(jd).appendTo('#brokerResolve');
    });
});


</script>

0

There are 0 best solutions below