flask - Can't define two var in javascript -


this question has answer here:

i want define 2 or more var in javascript code,but when define second one, first 1 becomes invalid.i have searched problem, don't why. can tell me how deal this? here javascript code(it's used convert json html table):

<script type="text/javascript">          var v_first = {{ pass_kegg|safe }}          var v_seconde = {{ pass_tmp|safe }}           function buildhtmltable(mylist) {             //builds html table out of mylist json data ivy restful service.          }           function addallcolumnheaders(mylist)          {              //adds header row table , returns set of columns.need union of keys records records may not containall records          }     </script> 

when define 1 variable,all things works fine. when fine second variablev_second,the first variable v_first becomes invalid.

seems should using tojson() filter dynamic javascript generation, ie

var v_first = {{ pass_kegg|tojson|safe }},     v_seconde = {{ pass_tmp|tojson|safe }}; 

it's practice terminate expressions semi-colon it's not required. see what rules javascript's automatic semicolon insertion (asi)?


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -