Last active
August 29, 2015 14:15
-
-
Save lmccart/b5e82da456859e0eac0f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// example calling API twice for two difference sentences | |
var s = 'The cat is mad.'; | |
$.getJSON(s, params, function(data) { | |
console.log(data); | |
}); | |
s = 'I am very old and tired and sad.' | |
$.getJSON(s, params, function(data) { | |
console.log(data); | |
}); | |
// example iterating through array of sentences and calling API for each | |
var paragraph = 'The cat is wearing a hat...blah blah blah. Some more sentences blah.' | |
var sentences = paragraph.split('. '); | |
for (var i=0; i<sentences.length; i++) { | |
$.getJSON(sentences[i], function(data) { | |
console.log(data); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment