Topic: Calendar error loading from serverside

Odhran priority asked 4 years ago

I populate the calendar with items from our serverside API - items are returned as JSON. If there is a JSON error returned from the API, I want to catch the error and redirect to another page.

I cannot figure out how to access the error returned from the API - is there an onError method or something similar? What JSON format should the error data returned from the API take?

Mateusz Łubianka staff commented 4 years ago


please, create a snippet showing your problem here: I'll try to help you.


Odhran priority commented 4 years ago

This is the jquery we are using to call our API, however the failure method is never called.

The API returns this JSON if there is an error: {"success":false,"message":"Unauthorized"}

Mateusz Łubianka staff answered 4 years ago


When you get the data from the API, you can use js code from our examples and fill 'events' with your date and etc.

events: [{
        title: title from API,
        start: your date,
        end: your date


Mateusz Łubianka staff answered 4 years ago


To get data form API and call a function after catch an error you can use:

fetch('something.json').then(function(response) {
return response.json();
}).then(function(json) {
let result = json;
}).catch(function(err) {
console.log('error');//your function after error


Odhran priority commented 4 years ago

How does that integrate with the calendar control?

Please insert min. 20 characters.


Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.



Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB jQuery
  • MDB Version: 4.8.9
  • Device: laptop
  • Browser: Chrome
  • OS: Windows
  • Provided sample code: No
  • Provided link: No