The history of today's json interface is shared with you. The data comes from wiki.
Copy codeThe Code is as follows:
// Http://history.sturgeon.mopaas.com // Home Page
// Http://history.sturgeon.mopaas.com/jsonp? Callback =? // Jsonp Interface
/// Http://history.sturgeon.mopaas.com/jsonp // json Interface
/// Http://history.sturgeon.mopaas.com/jsonp/1@1 // January 1 in history
/// Http://history.sturgeon.mopaas.com/1@1 // January 1 in history
$. GetJSON ('HTTP: // history.sturgeon.mopaas.com/jsonp? Callback =? ', Function (data ){
ParserTodayObj (data );
});
Function parserTodayObj (todayObj ){
For (var key in todayObj ){
If (/^. * born. * $/. test (key )){
DoBirthday (todayObj [key]);
}
If (/^. * holiday. * $/. test (key )){
DoHoliday (todayObj [key]);
}
If (/^. * customs. * $/. test (key )){
DoHoliday (todayObj [key]);
}
If (/^. * death. * $/. test (key )){
DoDeath (todayObj [key]);
}
If (/^. * Event Recording. * $/. test (key )){
DoMemorabilia (todayObj [key]);
}
}
}
ParserTodayObj (todayObj );
Function doBirthday (birthdays ){
If (birthdays. length! = 0 ){
$ (Document. body). append ("For (var I = 0; I <birthdays. length; I ++ ){
Var birthdayitem = birthdays [I];
$ (Document. body). append ("<p>" + birthdayitem + "</p> ");
};
}
}
Function doHoliday (holidays ){
If (holidays. length! = 0 ){
$ (Document. body). append ("For (var I = 0; I Var item = holidays [I];
$ (Document. body). append ("<p>" + item + "</p> ");
};
}
}
Function doDeath (deaths ){
If (deaths. length! = 0 ){
$ (Document. body). append ("For (var I = 0; I <deaths. length; I ++ ){
Var item = deaths [I];
$ (Document. body). append ("<p>" + item + "</p> ");
};
}
}
Function doMemorabilia (memorabilias ){
If (memorabilias. length! = 0 ){
$ (Document. body). append ("For (var I = 0; I <memorabilias. length; I ++ ){
Var item = memorabilias [I];
$ (Document. body). append ("<p>" + item + "</p> ");
};
}
}
Copy codeThe Code is as follows:
// Http://history.sturgeon.mopaas.com // Home Page
// Http://history.sturgeon.mopaas.com/jsonp? Callback =? // Jsonp Interface
/// Http://history.sturgeon.mopaas.com/jsonp // json Interface
/// Http://history.sturgeon.mopaas.com/jsonp/1@1 // January 1 in history
/// Http://history.sturgeon.mopaas.com/1@1 // January 1 in history
$. GetJSON ('HTTP: // history.sturgeon.mopaas.com/jsonp? Callback =? ', Function (data ){
ParserTodayObj (data );
});
Function parserTodayObj (todayObj ){
For (var key in todayObj ){
If (/^. * born. * $/. test (key )){
DoBirthday (todayObj [key]);
}
If (/^. * holiday. * $/. test (key )){
DoHoliday (todayObj [key]);
}
If (/^. * customs. * $/. test (key )){
DoHoliday (todayObj [key]);
}
If (/^. * death. * $/. test (key )){
DoDeath (todayObj [key]);
}
If (/^. * Event Recording. * $/. test (key )){
DoMemorabilia (todayObj [key]);
}
}
}
ParserTodayObj (todayObj );
Function doBirthday (birthdays ){
If (birthdays. length! = 0 ){
$ (Document. body). append ("For (var I = 0; I <birthdays. length; I ++ ){
Var birthdayitem = birthdays [I];
$ (Document. body). append ("<p>" + birthdayitem + "</p> ");
};
}
}
Function doHoliday (holidays ){
If (holidays. length! = 0 ){
$ (Document. body). append ("For (var I = 0; I Var item = holidays [I];
$ (Document. body). append ("<p>" + item + "</p> ");
};
}
}
Function doDeath (deaths ){
If (deaths. length! = 0 ){
$ (Document. body). append ("For (var I = 0; I <deaths. length; I ++ ){
Var item = deaths [I];
$ (Document. body). append ("<p>" + item + "</p> ");
};
}
}
Function doMemorabilia (memorabilias ){
If (memorabilias. length! = 0 ){
$ (Document. body). append ("For (var I = 0; I <memorabilias. length; I ++ ){
Var item = memorabilias [I];
$ (Document. body). append ("<p>" + item + "</p> ");
};
}
}