admin管理员组文章数量:1334281
looking at the google web eng example;
{% for greeting in greetings %}
{% if greeting.author %}
<b>{{ greeting.author }}</b> wrote:
{% else %}
An anonymous person wrote:
{% endif %}
<blockquote>{{ greeting.content|escape }}</blockquote>
{% endfor %}
so what i want is: when this iterates, i need to somehow check greeting.author agains some variable that exists in javascript, and then do some other stuff. is it possible to do it?
looking at the google web eng example;
{% for greeting in greetings %}
{% if greeting.author %}
<b>{{ greeting.author }}</b> wrote:
{% else %}
An anonymous person wrote:
{% endif %}
<blockquote>{{ greeting.content|escape }}</blockquote>
{% endfor %}
so what i want is: when this iterates, i need to somehow check greeting.author agains some variable that exists in javascript, and then do some other stuff. is it possible to do it?
Share Improve this question asked Feb 17, 2013 at 6:09 btevfikbtevfik 3,4313 gold badges29 silver badges40 bronze badges1 Answer
Reset to default 5{% for greeting in greetings %}
{% if greeting.author %}
<b>{{ greeting.author }}</b> wrote:
{% else %}
An anonymous person wrote:
{% endif %}
<blockquote>{{ greeting.content|escape }}</blockquote>
<script type="text/javascript">
var greeting_author = "{{ greeting.author }}";
if(greeting_author === someVariable){
// do other stuff here
}
</script>
{% endfor %}
Basically, you can just print the variable as js. Keep the type in mind (for example put ""
around them for strings).
本文标签: google app engineIs it possible to use jinja values in javascriptjquery functionsStack Overflow
版权声明:本文标题:google app engine - Is it possible to use jinja values in javascriptjquery functions - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742371721a2462368.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论