Skip to content

Instantly share code, notes, and snippets.

@h2ospace
Created February 25, 2020 07:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save h2ospace/a1d06a124ddc1aa15dd0b79aea144a34 to your computer and use it in GitHub Desktop.
Save h2ospace/a1d06a124ddc1aa15dd0b79aea144a34 to your computer and use it in GitHub Desktop.
Ajax by jQuery
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div id="news"></div>
<script src="jquery.min.js"></script>
<script>
$.getJSON('feed.json', function(json) {
var html = '<ul>';
for (var i=0; i<json.items.length; i++) {
html += '<li>' + json.items[i].title + '</li>';
}
html += '</ul>';
$('#news').html(html);
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment