Ajax request returns some information, including data_inicio
and data_fim
of a command, however I need to display only dates that are in red, it would be:
23/12/1936 à 12/12/1944
Ineedawaytomergeanddisplayonlythem.AtthemomentI'mdoingthis:
vararr=[];varper=[];functionprintarPeriodo(){varhtml='<br/>';for(variinper){html+='<iclass="fas fa-circle fa-xs"></i> ' + per[i] + '<br />';
}
html += '';
per = [];
return html;
}
function addArray(qual) {
var pass = false;
for (var i = 0; i < arr.length; i++) {
if (arr[i] == qual) {
pass = true;
}
}
if (!pass) {
arr.push(qual)
}
}
And using it as follows, within the return of my Ajax:
addArray(json[i].ano_inicio_f);
per.push(json[i].data_inicio_f + ' à ' + json[i].data_fim_f);