-1
Gentlemen, I’m setting up a system where he will consult an API and show the results within Divs. But I’m stopping this result, only by the console.log I’m not able to play inside the Divs. Follow the JSON return image:
I am trying to consume JSON as follows:
var url = 'https://allsportsapi.com/api/football/?met=H2H&APIkey=aafcadc8cb3f9937e6fb2576051b56ac980b9c342e99813b47ade59da2140522&firstTeamId=2616&secondTeamId=2617';
$.getJSON({
type: "GET",
url: url,
timeout: 3000,
datatype: 'JSON',
contentType: "application/json; charset=utf-8",
cache: false,
beforeSend: function() {
$("h2").html("Carregando..."); //Carregando
},
error: function() {
$("h2").html("O servidor não conseguiu processar o pedido");
},
success: function(retorno) {
// Interpretando retorno JSON...
console.log(retorno);
var clientes = retorno;
// Listando cada cliente encontrado na lista...
$.each(clientes,function(i, cliente){
var item = "<p>"+cliente.event_home_team+"</p><p>"+cliente.event_away_team+"</p>";
$("#retorno").append(item);
});
//Limpar Status de Carregando
$("h2").html("Carregado");
}
});
To fit in Layout: (but I need to correct the return of JSON, picking up the results I organize the Divs)
Thank you very much in advance!
Show, already got it! Thanks for the help!
– Cristiano Facirolli