Skip to content

Instantly share code, notes, and snippets.

@marti1125
Created October 16, 2012 05:25
Show Gist options
  • Save marti1125/3897352 to your computer and use it in GitHub Desktop.
Save marti1125/3897352 to your computer and use it in GitHub Desktop.
json data
<html>
<head>
<title>demo</title>
<meta charset="utf-8"/>
</head>
<body>
<div id="data">
</div>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
var a = 0;
var b = 0;
$.getJSON('videos.json', function(data) {
$.each(data, function(key, val) {
$.each(val, function(key2, val2) {
a++;
b++;
$('#data').append("<span><a href=# id=vtitulo" + a + " class=tit>" + val2.titulo + "</a></span><br/><span>" + val2.descripcion + "</span><br/><span>" + val2.latitud + "</span><br/><span>" + val2.longitud + "</span><br/><span id=cam" + b + ">" + val2.camara + "</span><br/><br/>");
$(".tit").click(function() {
if(a == a){
alert("algo");
}
});
});
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment