Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7413383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:41:12+00:00 2026-05-29T06:41:12+00:00

I am modifying a jQuery calendar and want to change this code: function getEventData()

  • 0

I am modifying a jQuery calendar and want to change this code:

function getEventData() {
  var year = new Date().getFullYear();
  var month = new Date().getMonth();
  var day = new Date().getDate();

  return {
     events : [
        {
           "id":1,
           "start": new Date(year, month, day, 12),
           "end": new Date(year, month, day, 13, 30),
           "title":"Lunch with Mike"
        },
        {
           "id":2,
           "start": new Date(year, month, day, 14),
           "end": new Date(year, month, day, 14, 45),
           "title":"Dev Meeting"
        },
        {
           "id":3,
           "start": new Date(year, month, day + 1, 17),
           "end": new Date(year, month, day + 1, 17, 45),
           "title":"Hair cut"
        },
        {
           "id":4,
           "start": new Date(year, month, day - 1, 8),
           "end": new Date(year, month, day - 1, 9, 30),
           "title":"Team breakfast"
        },
        {
           "id":5,
           "start": new Date(year, month, day + 1, 14),
           "end": new Date(year, month, day + 1, 15),
           "title":"Product showcase"
        },
        {
           "id":6,
           "start": new Date(year, month, day, 10),
           "end": new Date(year, month, day, 11),
           "title":"I'm read-only",
           readOnly : true
        },
        {
           "id":7,
           "start": new Date(year, month, day + 2, 17),
           "end": new Date(year, month, day + 3, 9),
           "title":"Multiday"
        }
     ]
  };
}

I want to pull the JSON data from a database in a PHP page. So I it would have to look something like:

   function getEventData() {

  $.getJSON('../ajax/calendar.php?type=get', function(data) {

        return data;
    });

     }

But I am getting an error saying “Uncaught TypeError: Cannot read property ‘options’ of undefined” which relates to the rendering of the data here:

_renderEvents: function(data, $weekDayColumns) {
      var self = this;
      var options = this.options;
      var eventsToRender;

      if (data.options) {
        var updateLayout = false;
        //update options
        $.each(data.options, function(key, value) {
            if (value !== options[key]) {
              options[key] = value;
              updateLayout = updateLayout || $.ui.weekCalendar.updateLayoutOptions[key];
            }
        });

The JSON returned:

 [{"id":"1","start":"Wed Jan 25 2012 11:30:00 GMT-0800 (PST)","end":"Wed Jan 25 2012 11:45:00 GMT-0800 (PST)","title":"test"}]

Did a test on the PHP page and the JSON is displaying as it should. Any suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T06:41:12+00:00Added an answer on May 29, 2026 at 6:41 am

    I assume the data in _renderEvents: function(data, $weekDayColumns) { is the data you retrieve with your getEventData() method and store it there then. This being the case, you need to wait until the data actually has content that is returned from the ajax.

    The block of code _renderEvents: function(data, $weekDayColumns) { must not be executed before the ajax has finished. You could wrap it in a function and call it onDataDone(), and then in your getJSON callback call that function.

    var data = '';
    
    function getEventData() {
        $.getJSON('../ajax/calendar.php?type=get', function(result) {
           data = result;
           onDataDone();
        });
    }
    
    function onDataDone() {
        // code that wraps the _renderEvents: function(data, $weekDayColumns) {...
    }
    
    getEventData();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Modifying a jQuery plugin, I have lines of code as follows: var currentread =
I'm monkey-patching some of the jQuery's Draggable code*. The goal is to avoid modifying
I am modifying some code that has a lot of jQuery but I am
I'm new to jQuery and am currently working on modifying Firas Kassem's password strength
I'm using the script from jquery file upload and modifying the create_scaled_image function to
I found this great jquery bubble script online - http://jqueryfordesigners.com/coda-popup-bubbles/ - and I want
I'm new to JQuery. I'm not looking necessarily for code -- just someone to
I am looking at modifying a jQuery Plugin to cater for an additional requirement
I am modifying some code and came across a declaration that I am having
I am modifying a SQL table through C# code and I need to drop

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.