This article mainly introduces what happened today in the history of code retrieval. The data comes from wiki. If you need it, refer to the historical json interface and share it with you. The data comes from wiki.
The 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 ("Born ");
For (var I = 0; I <birthdays. length; I ++ ){
Var birthdayitem = birthdays [I];
$ (Document. body). append ("
"+ Birthdayitem +"
");
};
}
}
Function doHoliday (holidays ){
If (holidays. length! = 0 ){
$ (Document. body). append ("holiday ");
For (var I = 0; I Var item = holidays [I];
$ (Document. body). append ("
"+ Item +"
");
};
}
}
Function doDeath (deaths ){
If (deaths. length! = 0 ){
$ (Document. body). append ("death ");
For (var I = 0; I <deaths. length; I ++ ){
Var item = deaths [I];
$ (Document. body). append ("
"+ Item +"
");
};
}
}
Function doMemorabilia (memorabilias ){
If (memorabilias. length! = 0 ){
$ (Document. body). append ("major event ");
For (var I = 0; I <memorabilias. length; I ++ ){
Var item = memorabilias [I];
$ (Document. body). append ("
"+ Item +"
");
};
}
}
The 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 ("Born ");
For (var I = 0; I <birthdays. length; I ++ ){
Var birthdayitem = birthdays [I];
$ (Document. body). append ("
"+ Birthdayitem +"
");
};
}
}
Function doHoliday (holidays ){
If (holidays. length! = 0 ){
$ (Document. body). append ("holiday ");
For (var I = 0; I Var item = holidays [I];
$ (Document. body). append ("
"+ Item +"
");
};
}
}
Function doDeath (deaths ){
If (deaths. length! = 0 ){
$ (Document. body). append ("death ");
For (var I = 0; I <deaths. length; I ++ ){
Var item = deaths [I];
$ (Document. body). append ("
"+ Item +"
");
};
}
}
Function doMemorabilia (memorabilias ){
If (memorabilias. length! = 0 ){
$ (Document. body). append ("major event ");
For (var I = 0; I <memorabilias. length; I ++ ){
Var item = memorabilias [I];
$ (Document. body). append ("
"+ Item +"
");
};
}
}