forked from swagger-api/swagger-js
-
Notifications
You must be signed in to change notification settings - Fork 2
/
example.html
32 lines (30 loc) · 1.03 KB
/
example.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<!DOCTYPE html>
<html>
<head>
<title>swagger.js example</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="./lib/swagger.js"></script>
<script type="text/javascript" src="./lib/shred.bundle.js"></script>
<script type="text/javascript">
$(function() {
wordnik = new SwaggerApi("http://api.wordnik.com/v4",
{
api_key: 'YOUR_API_KEY', // sample wordnik API key
verbose: true,
success: function() {
args = {word: 'sanctimonious'}
wordnik.word.getDefinitions(args, function(definitions){
console.log(definitions[0].word);
for (var i = 0; i < definitions.length; i++) {
var definition = definitions[i];
console.log(definition.partOfSpeech + ": " + definition.text);
}
});
}
});
});
</script>
</head>
<body>
</body>
</html>