0

I am trying to highlight days in a Zabuto calendar with data that I get from an Ajax response, but I keep getting a Syntax error, unrecognized expression on the returned data.

I'm using jquery-3.2.1 and Zabuto Calendar to display the days.

The response data:.

[
    {"date":"2018-03-26","badge":false,"title":"Example 1"},
    {"date":"2018-03-28","badge":false,"title":"Example 2"}
]

What I've tried

    var eventData = "";
    var eventsDataUrl = "my_url"; 
    $.get(eventsDataUrl, function (returnEventData) {                           
        eventData = returnEventData;            
    }); 

    $("#events-calendar").zabuto_calendar({             
        data: eventData,
        today: true,                
        show_days: true,
        nav_icon: {
          prev: '<i class="fa fa-chevron-left"></i>',
          next: '<i class="fa fa-chevron-right"></i>'
        }
    });
theEUG
  • 349
  • 5
  • 16
  • 1
    if you are doing it in the order I see here, `eventData` will be empty when you assign it to your calendar via `data: eventData`, mostly because your `$.get` response may not have returned data yet. – Napoli Mar 14 '18 at 22:03
  • 1
    try putting the call to `zabuto_calendar` INSIDE the callback from `.get`, right after `eventData = returnEventData;` – Scaramouche Mar 14 '18 at 22:05
  • @J.M.Echevarría your suggestion doesn't work for me – theEUG Mar 14 '18 at 22:14

0 Answers0