ASP.NET AJAX on the server side will handle object serialization for you. For example:
public class Name { public string FirstName; public string LastName; } [WebMethod] public Name GetName() { Name name = new Name(); name.FirstName = "Dave"; name.LastName = "Ward"; return name; }
You can then call PageMethod directly from jQuery, using basically the same method that JD is associated with. More specifically, here's a post about calling PageMethods with jQuery .
The server will serialize your return type as JSON, and you will be able to access the properties of the Name class as expected. In this example, msg.d.FirstName and msg.d.LastName .
Just watch out for .d. This is a security feature added in 3.5 and is not available in version 2.0.
Dave ward
source share