When refreshing calendar event page, it throws this error
Uncaught TypeError: Cannot call method ‘parse’ of undefined
calendar:239
$.ajax.success calendar:239
fire jquery-1.8.3.js:974
self.fireWith jquery-1.8.3.js:1084
done jquery-1.8.3.js:7803
callback jquery-1.8.3.js:8518
This does happen intermittently. I am parsing JSON object (from the server and it is in the correct format) in the scheduler, below is code snippet
dhx.ready(function () {
dhx.ui.fullScreen();
dhx.ui({
view: “scheduler”,
id: “scheduler”,
container: “scheduler-container”
});
});
var event = {
id: '',
start_date: '',
end_date: '',
text: '',
details: ''
};
var model = { event: [] }
$.ajax({
type: "POST",
url: ['@Url.Action](mailto:'@Url.Action)("CalendarEvents")', // add Mobile directory on Dev and Prod
dataType: "json",
error: function (xhr) {
//alert(xhr.responseText);
alert("Critical Error!. Failed to call the server.");
},
success: function (data, jqXHR) {
// There is no problem with the validation
if (data.noResult) {
alert("no events loaded");
return;
}
else {
//data is not valid display error message
model = data.events;
scheduler.EnableDataprocessor = true;
[b] $$("scheduler").parse(model, "json");
// it throws the error exactly after trying to parse JSON object[/b]
}
}
}
I am not sure what is the cause, any idea how I can fix this issue?
Thanks