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 627285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:30:42+00:00 2026-05-13T19:30:42+00:00

I’m playing around with the jQuery Week Calendar and am trying to get this

  • 0

I’m playing around with the jQuery Week Calendar and am trying to get this to work, but I can’t figure out why this is throwing an error.

The calendar has a method that returns a list of events to populate itself with.

The method (which uses preset events for demo purposes) looks like this:

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":6,
               "start": new Date(year, month, day, 10),
               "end": new Date(year, month, day, 11),
               "title":"I am read-only",
               readOnly : true
            }
         ]
      };
   }

I changed it so that it used a jQuery GET to another page that would return a list of real dates. For testing, I kept the same test data just to see if the post was being done properly.

The method will call the page, and it will return this in the responseText property.

{ 
  events : [
        {
           'id':1,
           'start': new Date(2010, 2, 22, 12),
           'end': new Date(2010, 2, 22, 13, 30),
           'title':'Lunch with Mike'
        },
        ...
        {
           'id':6,
           'start': new Date(2010, 2, 28, 10),
           'end': new Date(2010, 2, 28, 11),
           'title':'I am read-only',
           readOnly : true
        }
     ] 
 }

Is there a difference between the two methods that I’m missing? The two objects look exactly the same to me, except the second one uses ‘ instead of ” since it’s being written through C#, and it doesn’t use the year/month/day variables.

The problem is that the second method throws an error saying that “G is undefined”, is there any reason jQuery wouldn’t like the JSON object that I’m returning?

EDIT: I think I found the source of the error. Inside one of the methods there is an if statement like this:

 if (typeof options.data == 'string') {
        if (options.loading) options.loading(true);
        var jsonOptions = {};
        jsonOptions[options.startParam || 'start'] = Math.round(weekStartDate.getTime() / 1000);
        jsonOptions[options.endParam || 'end'] = Math.round(weekEndDate.getTime() / 1000);
        $.getJSON(options.data, jsonOptions, function(data) {
           self._renderEvents(data, $weekDayColumns);
           if (options.loading) options.loading(false);
        });
     }
     else if ($.isFunction(options.data)) {
        options.data(weekStartDate, weekEndDate,
              function(data) {
                 self._renderEvents(data, $weekDayColumns);
              });
     }

When just outputting the JSON object in getEventData() (the first way) it hit the else statement because it’s recognized as a function (I’m guessing), but when I do the ajax GET, it’s being considered a string and going into the if.

Is there anyway to get this recognized as a function? I tried wrapping the return in braces, changing the dataType to script and using eval() to cast the result as a function, but none of that seemed to work.

  • 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-13T19:30:42+00:00Added an answer on May 13, 2026 at 7:30 pm

    After searching through Google I came across the jQuery Week Calendar Google Group and this discussion had the exact same problem I was having.

    I think the main problem was the improper formatting of DateTimes. Returning the events JSON object directly converted the date properly, but my ajax call was returning new Date(2010, 02, 23, 12) as the times. It caused it to fail silently. Changing the datetimes to something like 2010-02-23T12:15:00.000+10:00 seems to have fixed it.

    However that user does appear to be incorrect about the events : [ breaking the JSON. I left it in my ajax call and it still works fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms
I know there's a lot of other questions out there that deal with this
Does anyone know how can I replace this 2 symbol below from the string
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text

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.