使用google api将事件添加到公共谷歌日历

时间:2016-06-29 21:23:47

标签: javascript google-api

我正在一个他可以租用预告片(http://www.cavalart.be/verhuur_thomas.php)的网站上工作。 为了方便我对租借进行概述,我将页面连接到谷歌日历。

它已使用以下脚本从日历中接收数据:

//Controleer data                               
var mykey = 'AIzaSyC_-oIV9yTVPw0Z9sDSM_mLQld_FPmIT4c'; // typically like Gtg-rtZdsreUr_fLfhgPfgff
var calendarid = '7a97f6k4ok8v77jc2po6kkgcuo@group.calendar.google.com'; // will look somewhat like 3ruy234vodf6hf4sdf5sd84f@group.calendar.google.com

$.ajax({
    type: 'GET',
    url: encodeURI('https://www.googleapis.com/calendar/v3/calendars/' + calendarid+ '/events?key=' + mykey),
    dataType: 'json',
    success: function (response) {
        if (typeof(Storage) !== "undefined") {
            //do whatever you want with each

    },
    error: function (response) {
        //tell that an error has occurred
    }
});

我想基于用户输入添加事件,使用相同类型的编程。像这样:

$.ajax({
type: 'POST',
url: encodeURI('https://www.googleapis.com/calendar/v3/calendars/' + calendarid+ '/events?key=' + mykey),
dataType: 'json',
start: 2016-06-29;
end: 2016-06-29;
description: "rent trailer";
success: function (response) {
    if (typeof(Storage) !== "undefined") {
        //do whatever you want with each

},
error: function (response) {
    //tell that an error has occurred
}
});

我如何解决这个问题?

0 个答案:

没有答案