Skip to content

Instantly share code, notes, and snippets.

@yuskesuzki
Last active October 11, 2016 08:05
Show Gist options
  • Save yuskesuzki/a4d09dd504054cc1ca041c06a4a01a0e to your computer and use it in GitHub Desktop.
Save yuskesuzki/a4d09dd504054cc1ca041c06a4a01a0e to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Localwiki api test</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
$.ajax({
url: "https://localwiki.org/api/v4/pages/?region=893&format=json", // リージョン:893 = 北海道森町を指定して、ページをAPIから検索
data: {},
success: function( result ) {
console.log(result);
for(var i=0; i<result.results.length; i++) {
// console.log(result.results[i].name);
$('#test').append('<p>');
$('#test').append('<h1>' + result.results[i].name + '</h1>');
$('#test').append('<br/>');
$('#test').append(result.results[i].content);
$('#test').append('<br/>');
$('#test').append('</p>');
$('#test').append('<hr/>');
}
}
});
});
</script>
</head>
<body>
<div id="test"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment