历史上的今天json接口 ,分享给大家,数据来源于wiki
$.getJSON('http://history.sturgeon.mopaas.com/jsonp?callback=?',function(data){
parserTodayObj(data);
});
function parserTodayObj(todayObj){
for(var key in todayObj){
if(/^.*出生.*$/.test(key)){
doBirthday(todayObj[key]);
}
if(/^.*假日.*$/.test(key)){
doHoliday(todayObj[key]);
}
if(/^.*风俗.*$/.test(key)){
doHoliday(todayObj[key]);
}
if(/^.*逝世.*$/.test(key)){
doDeath(todayObj[key]);
}
if(/^.*事记.*$/.test(key)){
doMemorabilia(todayObj[key]);
}
}
}
parserTodayObj(todayObj);
function doBirthday(birthdays){
if(birthdays.length != 0){
$(document.body).append("
"+birthdayitem+"
");function doHoliday(holidays){
if(holidays.length != 0){
$(document.body).append("
"+item+"
");function doDeath(deaths){
if(deaths.length != 0){
$(document.body).append("
"+item+"
");function doMemorabilia(memorabilias){
if(memorabilias.length != 0){
$(document.body).append("
"+item+"
");$.getJSON('http://history.sturgeon.mopaas.com/jsonp?callback=?',function(data){
parserTodayObj(data);
});
function parserTodayObj(todayObj){
for(var key in todayObj){
if(/^.*出生.*$/.test(key)){
doBirthday(todayObj[key]);
}
if(/^.*假日.*$/.test(key)){
doHoliday(todayObj[key]);
}
if(/^.*风俗.*$/.test(key)){
doHoliday(todayObj[key]);
}
if(/^.*逝世.*$/.test(key)){
doDeath(todayObj[key]);
}
if(/^.*事记.*$/.test(key)){
doMemorabilia(todayObj[key]);
}
}
}
parserTodayObj(todayObj);
function doBirthday(birthdays){
if(birthdays.length != 0){
$(document.body).append("
"+birthdayitem+"
");function doHoliday(holidays){
if(holidays.length != 0){
$(document.body).append("
"+item+"
");function doDeath(deaths){
if(deaths.length != 0){
$(document.body).append("
"+item+"
");function doMemorabilia(memorabilias){
if(memorabilias.length != 0){
$(document.body).append("
"+item+"
");