Puedo obtener con éxito un archivo json guardado en el servidor. Ahora quiero un valor específico que debe asignarse y usarlo dentro de otra matriz como variable.
Quiero que este valor provenga de un archivo JSON guardado a través de mySQL y use el valor en el calendario.
El código que tengo es:
var events = []; // I wanted to use inside this array. var gettitle = ""; $.getJSON(fileLocation, function (data) { //file is getting fetched successfully. $.each(data.data, function(i, v) { // there are two records and able to fetch each of them. gettitle = v.title; alert(gettitle); // alert both the titles. }); }); events = [ { id: 1, url: '', title: gettitle, // when i use the variable here, it is not displaying anything. just a calendar starting with Dec 2021 Month start: date, end: nextDay, allDay: false, extendedProps: { calendar: 'school' } }];