I am using ASP.net to display data on my calendar.
I have my feed setup to display on a page called feed.aspx (which is in the same folder as my calendar page). I call it like this on my calendar page:
events: {
url: 'feed.aspx',
type: 'POST',
data: {
custom_param1: 'something',
custom_param2: 'somethingelse'
},
error: function() {
alert('there was an error while fetching events!');
},
color: 'yellow', // a non-ajax option
textColor: 'black' // a non-ajax option
}
When I view the feed.aspx in my browser I see this:
{"title":"My Test Event","start":"2011-11-02T13:30:57","url":"http://orss.edu","allDay":"false"}
So I know that my feed.aspx is working ok.
But no matter what I try, no calendar data will show up.
Any help would be greatly appreciated.
My feed.aspx looks like this:
Imports System.Web.Script.Serialization
Imports System.Data
Imports System.Data.SqlClient
Public Class feed
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim dbu As New Utilities.DBUtilities
Dim conn As SqlConnection
Dim cmd As SqlCommand
Dim cmdText As String = "SELECT top(100) * FROM pageList"
Dim dr As SqlDataReader
Dim dictData As New Dictionary(Of String, String)
cmd = dbu.getCommand(cmdText)
conn = cmd.Connection
dbu.getCommand(cmdText)
conn.Open()
dr = cmd.ExecuteReader()
If dr.HasRows Then
Dim i As Integer = 0
Do While dr.Read()
'Response.Write(dr.Item("pageID") & "<br>")
dictData.Add(i.ToString, dr.Item("pageDisplayName"))
i = i + 1
Loop
End If
Dim testDict As New Dictionary(Of String, String)
testDict.Add("title", "My Test Event")
testDict.Add("start", DateTime.Now.ToString("s"))
testDict.Add("url", "http://oss.edu")
testDict.Add("allDay", "false")
Dim serializer As New JavaScriptSerializer()
Dim json As String = serializer.Serialize(DirectCast(testDict, Object))
Response.Clear()
Response.Write(json)
Response.End()
End Sub
End Class
Ok, I figured it out. It was because I was not wrapping the string in brackets like this: “[ JSON feed ]”