How to use Diffbot API with jQuery and JavaScript
-
1/2/2014
-
2148
-
diffbot example
Sample Code
function callDiffBotApi() {
var targetUrl = $("#targetUrlTxt").val();
var token = $("#tokenTxt").val();
var fields = $("#fieldTxt").val();
$.ajax({
url: "http://api.diffbot.com/v2/article",
data: {
token: token,
url: targetUrl,
fields : fields
},
success: function (data) {
$("#result").html($('<div/>').text($.toJSON(data)).html());
},
error: function (data) {
console.log(data);
$("#result").html("Ok Some think didnt worked out.");
}
})
}
Put in target URL in the text bax below and click "Call Diffbot" button
Expect some result here -