简体   繁体   中英

PhoneGap/Cordova calendar iOS plugin not sending info

Im pretty new to Cordova so please bear with me. I am using the plugin found here: https://github.com/phonegap/phonegap-plugins/tree/master/iOS/CalendarPlugin

And have implemented it in the example, but it is just not working for me. I get the error:

Uncaught SyntaxError: Unexpected token ( 

but cant see where this is coming from.

Can anyone point me in the right direction?

  $(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);
                               };
            });
        });

I sanitized your code a bit, try if that works:

/*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);
    }());
  });
});

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