0

I load all events on full-calender using Ajax , but problem events.push doesn't work

$(function() {
     var events = [];
        $.ajax({
         url: '/ajaxjson',
         Type: 'GET',
         dataType: 'json',
         success: function(data) {

             $.map(data, function(r) {

                 alert(r.libelle);  //it's work


                 events.push({title: r.libelle,
                           start: r.date,
                            end: r.enddate});
             });

         },
     error: function (error) {
        alert('error :'+eval(error));
         //alert('there was an error while fetching events!');
     },
     });

but events.push doesn't work

nickel
  • 55
  • 1
  • 8
  • use ajax to render in a div the value of your events, and first create an html to render the component – cralfaro Jun 13 '17 at 13:12
  • Possible duplicate of [jQuery ajax call to REST service](https://stackoverflow.com/questions/7112672/jquery-ajax-call-to-rest-service) – Andrei Epure Jun 13 '17 at 13:31
  • @aepure I load all events on full-calender using Ajax , but problem events.push doesn't work – nickel Jun 13 '17 at 13:58
  • @kamkam - in the browser, open the developer's console (F12) and see if you get any errors. what are the errors? What does 'data' contain (just print the JSON you get, use the Developer's console) – Andrei Epure Jun 14 '17 at 15:45

0 Answers0