ancarebeca / FullCalendarBundle

Symfony3 integration with the library FullCalendar.js
36 stars 38 forks source link

Ajax Request 404 #41

Closed ibrasdev closed 6 years ago

ibrasdev commented 6 years ago

Hello,

Thanks to you that I was able to correctly config this bundle with my symfony project <3

When i access full-calendar/load i can see the events loads from db in array : [{"title":"Yoga class","startDate":"2018-01-15T16:46:33+00:00","allDay":true,"editable":false,"startEditable":false,"durationEditable":false,"overlap":true,"id":2,"url":"jujujuju","end":"2018-01-24T16:46:33+00:00"}, {"title":"Mami","startDate":"2018-01-15T16:46:33+00:00","allDay":true,"editable":false,"startEditable":false,"durationEditable":false,"overlap":true,"id":3,"url":"jujujuju","end":"2018-01-25T16:46:33+00:00"}]

But in the calendar layout events dont load, the profiler say that a have 404 ajax request :

Method Type Status URL Time Profile
POST xhr 404 /full-calendar/load 104ms n/a

In Chrome Debug it seems that the problem is related to path, the POST METHOD failed 404 :

POST http://localhost/full-calendar/load 404 (Not Found)

The correct url should be : http://localhost/No/Web/app_dev.php/full-calendar/load

Please how can i fix that.

My routing file :

fos_js_routing:
    resource: "@FOSJsRoutingBundle/Resources/config/routing/routing.xml"

ancarebeca_fullcalendar:
    resource: "@FullCalendarBundle/Resources/config/routing.yml"

This is my head layout :

<script type="text/javascript" src="{{ asset('bundles/fullcalendar/js/fullcalendar/lib/jquery.min.js') }}"></script>

<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

<script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-confirmation/1.0.7/bootstrap-confirmation.js"></script>

<script src="{{ asset('bundles/fosjsrouting/js/router.js') }}"></script>

<script src="{{ path('fos_js_routing_js', { callback: 'fos.Router.setData' }) }}"></script>

<script type="text/javascript" src="{{ asset('bundles/fullcalendar/js/fullcalendar/lib/moment.min.js') }}"></script>

<script type="text/javascript" src="{{ asset('bundles/fullcalendar/js/fullcalendar/fullcalendar.min.js') }}"></script>

<script type="text/javascript" src="{{ asset('bundles/fullcalendar/js/fullcalendar/fullcalendar.default-settings.js') }}"></script>

Ive installed fosjsrouting.

Thanks for your help

ibrasdev commented 6 years ago

Solution : Edit fullcalendar.default-settings.js :

eventSources: [
            {
                url: 'full-calendar/load',
                type: 'POST',
                data: {},
                error: function () {}
            }

Edit URL to what you want