Данные API JSON:
{"status":200,"users":[{"twitter_screen_name":"mikerbrt","influencers":
[{"twitter_screen_name":"techcrunch","kscore":85.17},
{"twitter_screen_name":"tinucherian","kscore":61.5},
{"twitter_screen_name":"scobleizer","kscore":84.08},
{"twitter_screen_name":"startwerk","kscore":42.12},
{"twitter_screen_name":"mikeschwede","kscore":61.89}]}]}
Сценарий:
$( "#getTweets" ).bind( "click", function() {
var twitterUsername = $( "#twitterUsername" ).val();
var url = "http://api.klout.com/1/soi/influenced_by.json?key=7zcwhzhdp4w45q9fdqw9gqsc" + "&users=" + twitterUsername + "&callback=?";
$.getJSON( url, function( data ) {
for(var i=0; i < data.influencers.length; i++) {
alert(data.influencers[i].kscore);
}
});
});
Данные HTML:
<div id="input">
<span>Enter Twitter Username</span>
<input id="twitterUsername" type="text" />
<button id="getTweets">Get Tweets</button>
</div>
<ul></ul>
Требуемый вывод: необходимо отобразить показатель влияния влиятельных лиц