I use Metronic V34 with laravel9 to manage a set of events. I manage to save the data in the database but to display them with the method response()->json() in the calendar it gives me this error:Failure parsing JSON someone can help me please
there is te controller method to display the data:
public function displayEvent(Request $request)
{
if($request->ajax())
{
$d = $this->event->GetEvent();
return response()->json($d);
}
}
and the view page to show the json data:
...
editable: true,
dayMaxEvents: true, // allow "more" link when too many events
events: {
url: "/display-events",
dataType:"json",
success: function(data, xhr) {
console.log('XHR success callback');
},
failure: function(xhr) {
console.log('XHR failure callback');
}
},
...
Great! We're glad you were able to find a solution. Thank you for updating us. Have a wonderful day!
Hi Sillien,
It seems like there's an issue with the JSON data being returned from the API endpoint. To debug the issue, you can try the following steps:
Check the response status code: You can check the XHR status code by using the following code in the "failure" function:
console.log(xhr.status);
console.log(data);
thank you so much i find the solution now. thanks