Using a list of genes which I have created in a python script, I am trying to create clickable links for each gene in the list. I am using the Flask framework to accomplish this and am able to access the genes in my list with the {{genes}} variable. I am able to see this list when I view the page source, but when I try to add each gene to the body of my DOM with a javascript function I don't see anything. Does anyone know what I am doing wrong?
<!DOCTYPE html>
<html>
<head>
<h1>Genes<h1>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
</head>
<script type ="text/javascript">
function showGenes(){
var name = "";
for (gene in {{genes}}) {
var name = document.createElement('a');
var text = document.createTextNode(name);
name.appendChild(text);
document.body.appendChild(name);
}
}
</script>
<body onload="showGenes()">
</body>
</html>