I have a python Dictionary that looks like this
[{"hat": 91, "d1b": 2, "d1c": 1, "d1d": 5, "d1e": 7, "d1f": 77, "d1e": 999}
{"hat": 1, "d2b": 2, "d2c": 3, "d2d": 4, "d2e": 5, "d2f": 6, "d2e": 7}
{"hat": 1, "d3b": 2, "d3c": 3, "d3d": 4, "d3e": 5, "d3f": 6, "d3e": 7}]
And i pass this as a dictionary object (mydict) from python to jinja
What I'm tryrng to do is loop through each dictionary and print out the value of the key i search for. And have that show in a jquery alert box.
$(document).ready(function() {
{% for i in mydict %}
{{ loop.index0 }}, {{a,["hat"] }}
alert( {{ hat }} );
{% endfor %}
});
When i go to my web page it gives me an error of
Uncaught SyntaxError: Unexpected token &
$(document).ready(function() {
0, (Undefined, [[hat[])
alert( );
1, (Undefined, [hat])
alert( );
2, (Undefined, [hat])
alert( );
});
Its not being defined, and its not printing an alert.