I am working with the FullCalendar module (great, btw) and I'm having trouble populating events from the database. I am receiving a JSON string created by a C# web service. However, when I try to parse it and print out test alerts, I get nothing but "undefined".
My response string looks like this in Firebug:
{d="[{"ScheduleRecId":9,"EmployeeScheduled":"3","TimeStart":"\/Date(1285601677000)\/","TimeEnd":"\/Date(1285601677000)\/","UpdatedBy":"4","LastUpdate":"\/Date(1285601677000)\/","Started":true,"Finished":false}]"}
which appears to be an array, but when I try to access it from JQuery like:
success: function(doc) {
alert(doc) //echos "Object oject"
alert(doc[0]) //echos "undefined"
alert(doc.EmployeeScheduled) //echos "null"
}
I also tried using JSON.parse and eval() with not much luck. How can I access the properties of this object?
UpDate:
After Nick's answer, I decided to try alert(doc.d[0]);
which echoed [
I noticed that if I tried alert(doc.d[5]);
I get h
leading me to believe doc.d is coming across as a character array. I suppose I could read it in and parse it, but shouldn't there be a cleaner way to access the properties?