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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:44:51+00:00 2026-05-16T23:44:51+00:00

I’ve been trying to get this to work for weeks now, all to no

  • 0

I’ve been trying to get this to work for weeks now, all to no avail. I am sure that my code must be failing through something fairly small and stupid, but having tried a number of different approaches I’m starting to really struggle as to what the problem might be. Has anybody else managed to get the jQuery Week Calendar (http://github.com/themouette/jquery-week-calendar) working with an HTTPHandler returning the JSON?

I’ve tried:

  1. Hard-coding the JSON to come out of the handler as a string (e.g. “events: [{ etc }]”)
  2. Trying with or without the initial “events : “
  3. Using LINQ to retrieve data, then serializing with JavaScriptSerializer
  4. Using DataContractJsonSerializer instead
  5. Creating a ToJSON method with the above
  6. Using $.getJson to retrieve the data
  7. Using $.get instead
  8. Using $.ajax, with “async = false”
  9. Putting the data call in a function, then calling the function by:
    data: function(start, end, callback) {
        callback(getData());
    }

None of which seem to work. I’ve even tried running the data call before the calendar code using $.get, $getJSON and $.ajax, like:

    $.getJSON('/content/handlers/GetScheduledAppointments.ashx', function(json) {
        $calendar.weekCalendar({
            .
            .
            .
            data: json
        });
    });

I’ve tried so many different ways that I can’t really post every example of code that fails, but if anybody can help me I’ll be more than happy to post some examples if needed.

Has anybody managed to get these two things to work together…?

  • 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-16T23:44:51+00:00Added an answer on May 16, 2026 at 11:44 pm

    For anybody else having the same issues as me, I have a number of pointers that may help you. These are only things that I found helped me and are just guidance for anybody else who has wasted weeks of valuable time wondering why seemingly fine code doesn’t work. I am well aware my skillz are weak (old man), but if it helps save even one person some time then my time hasn’t been completely wasted.

    This is for C# .NET 3.5 Web Forms, not MVC.

    Firstly, make sure the ContentType and ContentEncoding properties of the Response object are set to JSON. In the past I have used “text/plain”, but this doesn’t seem to work for me on this occasion:

    context.Response.ContentType = "application/json";
    context.Response.ContentEncoding = Encoding.UTF8;
    

    If using LINQ, creating a new object in the order and format the calendar is expecting will help minimise problems with data irregularities. If you require read-only appointments then you can just add the option to the list. The “title” element below is working as an ISNULL or COALESCE would in SQL, as to prevent nulls being returned:

    var apps = (
        from a in db.Appointments
        select new {
            id = a.id,
            start = a.startTime.Value,
            end = a.endTime.Value,
            title = a.subjectLine == null ? "" : a.subjectLine
        }).ToList();
    

    Whilst there are many ways of serializing the dataset into JSON, I have found the most clean method is to use the NewtonSoft Json.NET library. This is as simple as adding one line to create a JSON object, with the necessary ISO8601 date formatting:

    return JsonConvert.SerializeObject(apps, new IsoDateTimeConverter());
    

    As far as the jQuery side goes I’ll only show the “data: ” function, as this is the part that had me flummoxed for the longest:

    data: function(start, end, callback) {
        $.ajax({
            url:        "/content/handlers/GetScheduledAppointments.ashx",
            type:       "GET",
            success:    function(json) {
                callback(json);
            },
            async:      false
        });
    }
    

    A handy tip regarding dates, which I came to before I started using the Json.NET library – if you simply cannot get .NET to return dates in a format that jWC likes, then use the[Date.js library to perform additional formatting in the jQuery itself. For days I couldn’t get my back-end to output the start and end times in a format that would render on the calendar, no matter what I tried. In all the functioning examples (with local data being generated in the jQuery) the dates were being created using the following format:

    new Date(year, month, day, hour, minute)
    

    So, using this basis, it is also possible to explicitly cast dates returned from the back end, as the Date.js library will take almost anything approaching a date and work its magic:

    data: function(start, end, callback) {
        $.ajax({
            url:        "/content/handlers/GetScheduledAppointments.ashx",
            type:       "GET",
            success:    function(json) {
                if ($.isArray(json)) { 
                    $.each(json, function(key, value) { 
                        value.start = new Date(value.start); 
                        value.end = new Date(value.end); 
                    });
                }
                callback(json);
            },
            async:      false
        });
    }
    

    I know none of this is very leet (or even optimised), but hopefully this can be of use to some people who are having real difficulty with jWC and .NET.

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

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I'm looking for suggestions for debugging... If you view this site in Firefox or
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but

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.