How can we change JSON String to a Javascript Object using JSON.parse for an API URL?
We need Full Calendar to GET events from our API URL. Our API has a JSON String, Full Calendar needs a Javascript Object, we are trying to convert it to a Javascript Object using JSON.parse How can we edit var javascriptObj = JSON.parse(jSonString); with the following code to work with a URL?
Thanks so much in advance!
OUR JAVASCRIPT:
$(document).ready(function() {
$('#calendar').fullCalendar({
//theme: true,
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
defaultDate: moment().format("YYYY-MM-DD"),
editable: true,
events: {
url: 'URL WE WANT TO KEEP PRIVATE',
type: 'GET',
contentType: "application/json; charset=utf-8",
dataType: "json",
contentType: 'application/json; charset=utf-8',
success: function(resultData) {
//here is your json.
// process it
},
error : function(jqXHR, textStatus, errorThrown) {
},
}
});
});