1

Im trying to render a json data to a scheduler but fail to render (no errors on the console though, please check my code below.

my front-end side

//event calendar
$(".myscheduler").dhx_scheduler({
    xml_date:"%Y-%m-%d %H:%i",
    date:new Date(),
    mode:"month"
});

   $.ajax({
   url : $("body").attr("data-link") + '/json/get-data',
   dataType: 'json',
   type: 'post',
   data : { _token : $("body").attr("data-token") },
   success: function(response){
       scheduler.parse(response.test);

   }
});

and here's my side script part (php)

$response = array(['id' => '1', 'start_date' => '2015-10-16 00:00:00', 'end_date' => '2015-11-16 00:00:00', 'text' => 'test', 'details' => 'Details for French Open'], ['id' => '2', 'start_date' => '2015-11-16 00:00:00', 'end_date' => '2015-11-16 00:00:00', 'text' => 'test', 'details' => 'Details for French Open']);

echo json_encode(['success' => true, 'test' => $response]);

any help, clues, ideas, suggestions, recommendations so that I could render the json response to the dhtmlx scheduler?

Juliver Galleto
  • 8,831
  • 27
  • 86
  • 164

1 Answers1

1

Try to specify "json" format in the second argument of parse method, otherwise it would expect xml by default:

scheduler.parse(response.test, "json");

http://docs.dhtmlx.com/scheduler/api__scheduler_parse.html

Paul
  • 1,656
  • 11
  • 16