简体   繁体   中英

Fullcalendar with asp.net mvc not showing events

I'm trying to fetch events from my database.

events: {
    url: "/Planning/Planning/GetEventsUnit/@ViewBag.Unit.Code/",
    method: 'POST',
    failure: function() {
        alert('Erreur dans la récupération des événements !');
    },
},

No error message. The JSON response seem to be correct.

[{"id":3,"start":"2019-08-30T09:00:00","end":"2019-08-30T14:00:00","ressourceId":"12345678"}]

When i try to declare event in the code instead of database query, like this:

EDIT [2019/09/07] : ressourceId instead of resourceId, error while i wrote the post

events:[
  {
    id: 3,
    start: "2019-08-30T09:00:00"
    end: "2019-08-30T14:00:00" 
    resourceId":"12345678"
  },
],

It's work.

If someone could give me a little help it would greatly appreciated.

I test your code and it all works well.You need to have the POST action like:

[HttpPost("/Planning/Planning/GetEventsUnit/{code}")]
 public JsonResult Test(int code,DateTime start,DateTime end)
 {
   //logic
 }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM