I have the following JQuery Template
<script id="SearchResultsTemplate" type="text/x-jquery-tmpl">
{{each Hits}}
Page ${PAGENUMBER} - ${autn:summary}
{{/each}}
</script>'
I can pull the PAGENUMBER tag out of the JSON but the template is not compiled correctly when i try an开发者_JAVA百科d use autn:summary
How can I escape it?
I have tried \: and \\: and \3A but it complains about invalid characters.
Thanks
Do I understand correctly that your data or a sub part of your data has a colon in the key? Then, if your data looks like this:
{
"a:1": 1,
"sub": [{
"b:1": 'x'
},{
"b:1": 'y'
}]
}
use the following in your template
${$data['a:1']}
{{each(i,s) sub}}
${s['b:1']}
{{/each}}
jsfiddle here: http://jsfiddle.net/brettwp/p9WUN/
Have you tried \\
(double backslash)?
for selectors you have to do that. Maybe it's the same in your case. Look here
精彩评论