Created
April 1, 2016 04:13
-
-
Save Uriel29/0359911ff2849d9e1e46044dea6058a8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>JSON Sample</title> | |
</head> | |
<body> | |
<div id="resultado"></div> | |
<div id="resultado2"></div> | |
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script> | |
<script> | |
$.getJSON( "http://site/site/index.php/json/", function( data ) { | |
//console.log(data); | |
//var teste = (data[0]['cidade']); | |
//console.log(data[1]['cidade']); | |
for (var i = 0; i <data.length; i++) { | |
//console.log(data[i]['id']); | |
//console.log(data[i]['cidade']); | |
$( "#resultado" ).append('<li>' +data[i]['nome'] + ' é ' + data[i]['cidade'] +'</li>' ); | |
$( "#resultado2" ).append('<img src="http://site/site/'+data[i]['Imagem']+'">'); | |
} | |
//$( "#resultado" ).html( teste); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment