A interface JSON de hoje na história, vou compartilhar com você.
A cópia do código é a seguinte:
//http://history.sturgeon.mopaas.com // homepage
//http://history.sturgeon.mopaas.com/jsonp?callback=? // interface jsonp
//http://history.sturgeon.mopaas.com/jsonp // json interface
//http://history.sturgeon.mopaas.com/jsonp/1@1 // 1 de janeiro na história
//http://history.sturgeon.mopaas.com/1@1 // 1 de janeiro na história
$ .getjson ('http://history.sturgeon.mopaas.com/jsonp?callback=?'.function (dados) {
parsertodayobj (dados);
});
função parsertodayobj (TodayObj) {
para (tecla var no TodayObj) {
if (/^.* nascido.*$/. test (chave)) {
Dobirthday (TodayObj [key]);
}
if (/^.* Holiday.*$/. Test (key)) {
Doholiday (TodayObj [key]);
}
if (/^.* Custom.*$/. Test (key)) {
Doholiday (TodayObj [key]);
}
if (/^.* Death.*$/. Test (key)) {
Dodeath (TodayObj [key]);
}
if (/^.* Events.* $/. Test (key)) {
domemorabiliia (TodayObj [key]);
}
}
}
parsertodayobj (TodayObJ);
função Dobirthday (aniversários) {
if (aniversários.length! = 0) {
$ (document.body) .append ("<h3> nascido </h3>");
for (var i = 0; i <birthdays.length; i ++) {
Var BirthoneItem = aniversários [i];
$ (document.body) .append ("<p>"+birthoneitem+"</p>");
};
}
}
função Doholiday (feriados) {
if (holidays.length! = 0) {
$ (document.body) .append ("<h3> festival </h3>");
for (var i = 0; i <holidays.length; i ++) {
var item = feriados [i];
$ (document.body) .append ("<p>"+item+"</p>");
};
}
}
função dodeath (mortes) {
if (deaths.length! = 0) {
$ (document.body) .Append ("<H3> Death </h3>");
for (var i = 0; i <Deaths.Length; i ++) {
var item = mortes [i];
$ (document.body) .append ("<p>"+item+"</p>");
};
}
}
função domemorabiliia (memorabilias) {
if (memorabilias.length! = 0) {
$ (document.body) .append ("<h3> principal evento </h3>");
for (var i = 0; i <memorabilias.length; i ++) {
var item = memorabilias [i];
$ (document.body) .append ("<p>"+item+"</p>");
};
}
}
A cópia do código é a seguinte:
//http://history.sturgeon.mopaas.com // homepage
//http://history.sturgeon.mopaas.com/jsonp?callback=? // interface jsonp
//http://history.sturgeon.mopaas.com/jsonp // json interface
//http://history.sturgeon.mopaas.com/jsonp/1@1 // 1 de janeiro na história
//http://history.sturgeon.mopaas.com/1@1 // 1 de janeiro na história
$ .getjson ('http://history.sturgeon.mopaas.com/jsonp?callback=?'.function (dados) {
parsertodayobj (dados);
});
função parsertodayobj (TodayObj) {
para (tecla var no TodayObj) {
if (/^.* nascido.*$/. test (chave)) {
Dobirthday (TodayObj [key]);
}
if (/^.* Holiday.*$/. Test (key)) {
Doholiday (TodayObj [key]);
}
if (/^.* Custom.*$/. Test (key)) {
Doholiday (TodayObj [key]);
}
if (/^.* Death.*$/. Test (key)) {
Dodeath (TodayObj [key]);
}
if (/^.* Events.* $/. Test (key)) {
domemorabiliia (TodayObj [key]);
}
}
}
parsertodayobj (TodayObJ);
função Dobirthday (aniversários) {
if (aniversários.length! = 0) {
$ (document.body) .append ("<h3> nascido </h3>");
for (var i = 0; i <birthdays.length; i ++) {
Var BirthoneItem = aniversários [i];
$ (document.body) .append ("<p>"+birthoneitem+"</p>");
};
}
}
função Doholiday (feriados) {
if (holidays.length! = 0) {
$ (document.body) .append ("<h3> festival </h3>");
for (var i = 0; i <holidays.length; i ++) {
var item = feriados [i];
$ (document.body) .append ("<p>"+item+"</p>");
};
}
}
função dodeath (mortes) {
if (deaths.length! = 0) {
$ (document.body) .Append ("<H3> Death </h3>");
for (var i = 0; i <Deaths.Length; i ++) {
var item = mortes [i];
$ (document.body) .append ("<p>"+item+"</p>");
};
}
}
função domemorabiliia (memorabilias) {
if (memorabilias.length! = 0) {
$ (document.body) .append ("<h3> principal evento </h3>");
for (var i = 0; i <memorabilias.length; i ++) {
var item = memorabilias [i];
$ (document.body) .append ("<p>"+item+"</p>");
};
}
}