I was working with a Sentiment Analysis API which requires a curl request to get the JSON object.
How can this be done with AJAX?
This is the curl request:
$ curl -d "text=great" http://text-processing.com/api/sentiment/
This is what I have tried:
$.ajax("http://text-processing.com/api/sentiment/", {
type: "POST",
data: JSON.stringify({ text: "Hello world!" }),
contentType: "application/json",
}).done(function(data){
alert('done');
}).fail(function(xhr, status, error){
});