My problem is that i call an api which gives me a set of json data which i need to bind through javascript. I am using fullcalendar API to show the calendar. Below i just paste my code please help me. In console i donot have any error but still it is not working.
I am using asp.net mvc 5 for my api and to fetch the request i directly use javascript js6 fetch .
My javascript code
document.addEventListener('DOMContentLoaded', function () {
var calendarEl = document.getElementById('calendar');
//fetch data for events
var eventdata = fetch('@Url.Action("GetTsdates", "Remo")')
.then(function (responce) {
responce.json().then(function (data) {
console.log(data);
return data;
})
})
.catch(function (err) {
console.log('Fetch Error :-S', err);
});
var calendar = new FullCalendar.Calendar(calendarEl, {
plugins: ['interaction', 'dayGrid'],
//defaultDate: '2019-06-12',
editable: true,
eventLimit: true,
events: eventdata
});
calendar.render();
});
The json data in console
{start: "2019-06-01", overlap: false, rendering: "background", color: "#f44242"},
{start: "2019-06-02", overlap: false, rendering: "background", color: "#f44242"},
{start: "2019-06-03", overlap: false, rendering: "background", color: "#f44242"},
{start: "2019-06-04", overlap: false, rendering: "background", color: "#f44242"},
{start: "2019-06-05", overlap: false, rendering: "background", color: "#f44242"},
{start: "2019-06-06", overlap: false, rendering: "background", color: "#f44242"},
{start: "2019-06-07", overlap: false, rendering: "background", color: "#f44242"},
{start: "2019-06-08", overlap: false, rendering: "background", color: "#f44242"},
{start: "2019-06-09", overlap: false, rendering: "background", color: "#f44242"},
{start: "2019-06-10", overlap: false, rendering: "background", color: "#f44242"},
{start: "2019-06-11", overlap: false, rendering: "background", color: "#f44242"},
{start: "2019-06-12", overlap: false, rendering: "background", color: "#f44242"},
{start: "2019-06-13", overlap: false, rendering: "background", color: "#f44242"},
{start: "2019-06-14", overlap: false, rendering: "background", color: "#f44242"},
{start: "2019-06-15", overlap: false, rendering: "background", color: "#f44242"},
{start: "2019-06-16", overlap: false, rendering: "background", color: "#f44242"}
i Donot hava any error in console. But still it is not working . Thanks in advance.