Skip to content

Instantly share code, notes, and snippets.

@agnaite
Created February 23, 2017 02:49
Show Gist options
  • Save agnaite/b2674511acc5bd2745fa7f2005ebc843 to your computer and use it in GitHub Desktop.
Save agnaite/b2674511acc5bd2745fa7f2005ebc843 to your computer and use it in GitHub Desktop.
jinja loops in js
<html>
<head>
<title></title>
</head>
<body>
<h2>Temples</h2>
<div></div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script type="text/javascript">
{% for temple in temples %}
$("div").append("{{temple.temple_name}}<br/>"); //append each temple name to div tag
var longt = parseInt("{{temple.long}}"); //get each longtitude and save as an int
var lat = parseInt("{{temple.long}}"); //get each latitude and save as an int
{% endfor %}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment