0
I have a variable where stores the result of a JSON through an AJAX request, as below:
$.ajax(
{
url: 'endpoint',
method: 'GET',
data: {
action: 'getAgenda',
keyuser: idLess
},
success: function(response){
var dados_agenda = response;
},
dataType: 'json'
}
);
giving a.log console on the date_agenda variable, I have the following JSON result:
{
"id": "1",
"title": "reuniãp",
"start": "2019-03-19 10:00:00",
"end": "2019-03-19 11:00:00",
"situacao": "A",
"cor": "#4761c5",
"Update": "2019-03-17 16:24:00"
}{
"id": "2",
"title": "Churrasqueira",
"start": "2019-03-20 10:00:00",
"end": "2019-03-20 11:00:00",
"situacao": "A",
"cor": "#4761c5",
"Update": "2019-03-17 18:17:00"
}
My difficulty is to play the JSON stored in the data_agenda variable, in the Events property of the Fullcalendar library, as below:
$(document).ready(function() {
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,basicWeek,basicDay'
},
defaultDate: '2019-03-12',
navLinks: true,
editable: true,
eventLimit: true,
events:[
{
id: 999, <- id entrar aqui
title: 'All Day Event', <- title entrar aqui
start: '2019-01-01', <- start entrar aqui
end: '2019-03-07' <- end entrar aqui
},
{
id: 999, <- id entrar aqui
title: 'Long Event', <- title entrar aqui
start: '2019-03-07', <- start entrar aqui
end: '2019-03-07' <- end entrar aqui
}
]
});
});
I couldn’t evolve the code until I got to that part. How could I go with the code?
I could put this script exactly in what code location ?
– Robson Freitas
Down in Ajax, after
var dados_agenda = response;
.– Sam
Perfect dear friend, I’m going to do a test now. I’m going to adjust my Json
– Robson Freitas