Created
January 30, 2014 20:41
-
-
Save tinybeans/8718253 to your computer and use it in GitHub Desktop.
複数のブログの記事数をData APIで取得してみる
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
var api = new MT.DataAPI({ | |
baseUrl: '/mt_dir/mt-data-api.cgi', | |
clientId: 'mt data api test.' | |
}); | |
var blog_ids = [1, 2, 3]; | |
var total = 0; | |
var responsed = 0; | |
for (var i = 0, l = blog_ids.length; i < l; i++) { | |
api.listEntries( | |
blog_ids[i], | |
{ | |
fields : "title,permalink,date" | |
}, | |
function(response) { | |
responsed++; | |
total += Number(response.totalResults); | |
if (responsed == l) { | |
$("#result").html("total Rows = "+ total +"件"); | |
} | |
} | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment