Getting JSON from a .NET web service with JQuery -


I am working with FullCalendar module (Great, BTW) and I'm having trouble finding events from database is. I am receiving a JSON string created by a C # web service. However, when I try to parse it and print the test alert, I do not get anything "undefined".

My response string looks like this in Firebug:

  {d = "[{" ScheduleRecId ": 9," EmployeeScheduled ":" 3 "," Initial " : "\ / Date (1285601677000) \ /", "TimeEnd": "\ / date (1285601677000) \ /", "UpdatedBy": "4", "last updated": "\ / date (1285601677000) \ /" , "Start": true, "end": wrong}] "}  

is an array, but when I try to access it from JQuery:

< Pre-> success: function (doctor) {alert (doc) // echos "ogle og" warning (doctor [0]) // echos "undefined" alert (doc.EmployeeScheduled) // echos "null"} < / Code>

I have not even tried using JSON.parse and eval (), with great fortune. How can I access the properties of this object?

Update: After Nick's answer, I tried alert (doc.d [0]); which looks at [

I have seen that if I tried the warning (doc.d [5]); I get h leading me to believe that doc.d is coming in as a character array. I think I can read it and parse it, but there should not be a clear way to reach the qualities?

Because it is from ASP.NET 3.5 or higher, it looks like you have d < / Code> property needs, such as:

  success: work (doctor) {warning (doc.d [0] .EmployeeScheduled); }  

The reason is that the root object has a property, d , which is an array of objects ... then use [ 0] to get the first entry, then . Employer Scheduling to get that property


Comments