我对Cordova很新,所以请耐心等待。我使用的是此处的插件:https://github.com/phonegap/phonegap-plugins/tree/master/iOS/CalendarPlugin
并在示例中实现了它,但它对我不起作用。我收到错误:
Uncaught SyntaxError: Unexpected token (
但无法确定这是来自哪里。
有人能指出我正确的方向吗?
$(function() {
$('.calinfo').live('click', function() {
var desiredValue = $(this).data('calinfo');
var cal;
cal = window.plugins.calendarPlugin
// function call in Javascript:
//createEvent :
function(title,location,notes, startDate, endDate){
var title= "My Appt";
var location = "Los Felix";
var notes = "me testing";
var startDate = "2012-11-23 09:30:00";
var endDate = "2012-11-23 12:30:00";
cal.createEvent(title,location,notes,startDate,endDate);
};
});
});
答案 0 :(得分:0)
我稍微清理了你的代码,试试这是否有效:
/*global $:true */
$(function() {
"use strict";
$('.calinfo').live('click', function() {
var desiredValue = $(this).data('calinfo');
var cal = window.plugins.calendarPlugin;
// function call in Javascript:
//createEvent :
(function createEvent(title, location, notes, startDate, endDate) {
title= "My Appt";
location = "Los Felix";
notes = "me testing";
startDate = "2012-11-23 09:30:00";
endDate = "2012-11-23 12:30:00";
cal.createEvent(title,location,notes,startDate,endDate);
}());
});
});