How to update an event in Google Calendar using javascript?

前端 未结 4 1272
萌比男神i
萌比男神i 2021-01-17 04:49

I need to update the name of some Google Calendar events, once I get them through JavaScript. I only have the sample code which Google shows in their Google Developer site,

4条回答
  •  粉色の甜心
    2021-01-17 05:36

    You have to perform an HTTP (PUT) Request. This could maybe done be done with AJAX or jQuery.ajax():

    jQuery.ajax:

    //This is the event data you got, with the changed values, you want to be changed in Calendar API
    var changedEventData;
    
    //changing the data of an calendar event
    $.ajax({
      url: "https://www.googleapis.com/calendar/v3/calendars/" + calendarId + "/events/" + eventId,
      method: "PUT",
      data: changedEventData
    });
    

    Remember to implement jQuery

    I hope this works for you!

提交回复
热议问题