Sunday, 15 May 2011

google app engine - Is it possible to use jinja values in javascript/jquery functions -



google app engine - Is it possible to use jinja values in javascript/jquery functions -

looking @ google web eng example;

{% greeting in greetings %} {% if greeting.author %} <b>{{ greeting.author }}</b> wrote: {% else %} anonymous person wrote: {% endif %} <blockquote>{{ greeting.content|escape }}</blockquote> {% endfor %}

so want is: when iterates, need somehow check greeting.author agains variable exists in javascript, , other stuff. possible it?

{% greeting in greetings %} {% if greeting.author %} <b>{{ greeting.author }}</b> wrote: {% else %} anonymous person wrote: {% endif %} <blockquote>{{ greeting.content|escape }}</blockquote> <script type="text/javascript"> var greeting_author = "{{ greeting.author }}"; if(greeting_author === somevariable){ // other stuff here } </script> {% endfor %}

basically, can print variable js. maintain type in mind (for illustration set "" around them strings).

javascript google-app-engine jinja2

No comments:

Post a Comment