I'm fetching JSON data from a summarization API and I'd like to use one of the returned values as a variable I can later manipulate. I'm getting JSON data from this URL:
http://clipped.me/algorithm/clippedapi.php?url=http://www.bbc.com/news/world-asia-china-30067035
and it returns this:
{"title":"BBC News - Hong Kong protest leaders denied Beijing flight","summary":["They had hoped to meet China's leaders as part of their push for greater democracy, but were told at the airport that their travel permits were invalid.","They want Beijing to allow more candidates to stand in the territory's next leadership election in 2017.","The group were greeted at the airport by fellow democracy activists, who unfurled yellow umbrellas - a symbol of Hong Kong's democracy movement."],"source":"bbc.com"}
I've tried var story = json.results[0].summary; but it's not working.
My code looks like this:
$.ajax({
type : "GET",
crossOrigin: true,
dataType : "jsonp",
url : "http://clipped.me/algorithm/clippedapi.php?url=http://www.bbc.com/news/world-asia-china-30067035",
success: function(data){
var story = json.results[0].summary;
$('p').html(story)
}
});
Update: JSFIDDLE