Created
February 25, 2020 07:27
-
-
Save h2ospace/a1d06a124ddc1aa15dd0b79aea144a34 to your computer and use it in GitHub Desktop.
Ajax by jQuery
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="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