javascript - Firefox console getting SyntaxError: illegal character -


i trying following code http://jsfiddle.net/qlmhuge/t7a1sh4u/ work in wordpress 4.5.2. example spotify web api html widgets. getting following error:

syntaxerror: illegal character {{#each albums.items}} on # sign

the site trying run on here: http://dev-markandersonpianist.pantheonsite.io/discography/

here script getting error:

<script id="results-template" type="text/x-handlebars-template">     {{#each albums.items}}     <div style="background-image:url({{images.0.url}})" data-album-id="{{id}}" class="cover"><a href="{{external_urls.spotify}}"><div class="spotify-button"><img src="https://developer.spotify.com/wp-content/uploads/2014/06/play_on_spotify-green.png" /></div></a></div>     {{/each}} </script> 

it works in jsfiddle can see above. don't understand why it's not working in wordpress.

that's because of {{#each albums.items}} , {{/each}}. # means start comment. / means start regexp. { means start describing object.

here, it's because of 2 {{. can't use object property label , property must labeled in object.

it looks it's template generate code. sure content correctly generated before. browser can't understand template generation code.


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -