Created
May 23, 2014 02:35
-
-
Save Wysie/32b2f7276e4bd6acb66a to your computer and use it in GitHub Desktop.
AlchemyAPI jQuery API Call
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
//Hackish, using JSONP as JSON doesn't work. I wrote this portion for a Chrome extension and didn't see the need to host a server separately just to handle AlchemyAPI calls. | |
$.ajax({ | |
url: 'https://access.alchemyapi.com/calls/text/TextGetTextSentiment', | |
dataType: 'jsonp', | |
jsonp: 'jsonp', | |
type: "post", | |
data: { apikey: 'APIKEYHERE', text: streamText, outputMode: 'json' }, | |
success: function(res) { | |
if (res["status"] === "OK") { | |
//Do something good | |
} | |
else if (res["status"] === "ERROR") { | |
//Do something bad | |
} | |
}, | |
error: function(jqxhr) { | |
//console.log(jqxhr); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment