Sorry for posting this again, but I can't find anything useful on the internet.
I'm trying to create a calendar. I'm using symfony 3 and fullcalendar to create it.
So in my twig class I've created a variable:
{% set fff = "" %}
Into fff variable I add some text like {start: "2017-05-17", title: "Take my mom from airport"},
Then I pass the fff variable to JS:
<script>
var allTasks = {{ fff|json_encode()|raw }};
</script>
Then if I want to add this task {start: "2017-05-17", title: "Take my mom from airport"},, allTasks variable, to the calendar. So I've created a function:
$(function(){
$('#calendar').fullCalendar({
events: [
//there I should add tasks
//f.e. {start: "2017-05-17", title: "Take my mom from airport"},
//this code adds a task into my calendar
],
});
});
When I put code like in the example it works fine, but when I try to do something like:
$(function(){
$('#calendar').fullCalendar({
events: [
allTasks, //this variable is equal to "{start: "2017-05-17", title: "Take my mom from airport"},"
],
});
});
This gives me nothing. Even calendar disappear from my web.
So the question is what I'm doing wrong? allTasks var prints out {start: "2017-05-17", title: "Take my mom from airport"},. I've tested it, but when I try to use it inside my function it doesn't work.
Error log:
[2017-05-15 11:40:36] request.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "No route found for "GET /[%7Bstart:'2017-05-17',title:'Take%20my%20mom%20from%20airport'%7D]" (from "http://127.0.0.1:8000/home")" at /home/david/task_manager/var/cache/dev/classes.php line 3497 {"exception":"[object] (Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException(code: 0): No route found for \"GET /[%7Bstart:'2017-05-17',title:'Take%20my%20mom%20from%20airport'%7D]\" (from \"http://127.0.0.1:8000/home\") at /home/david/task_manager/var/cache/dev/classes.php:3497, Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException(code: 0): at /home/david/task_manager/var/cache/dev/appDevDebugProjectContainerUrlMatcher.php:162)"} []
