Skip to content

Instantly share code, notes, and snippets.

@Mailaender
Created March 17, 2013 11:29
Show Gist options
  • Save Mailaender/5181169 to your computer and use it in GitHub Desktop.
Save Mailaender/5181169 to your computer and use it in GitHub Desktop.
Another failed attempt to get jQuery.getJSON() to work
<!DOCTYPE html>
<html>
<head>
<title>OpenRA Master Server</title>
</head>
<body>
<h1>OpenRA Master Server</h1>
<script type="text/javascript" src="jquery-1.9.1.js"></script>
<script type="text/javascript">
$.getJSON('list_json.php', function(data) {
var items = [];
$.each(data, function(key, val) {
items.push('<li id="' + key + '">' + val + '</li>');
});
$('<ul/>', { 'class': 'my-new-list',
html: items.join('')
}).appendTo('body');
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment