I have a simple web service with a web method that creates a list of objects..
public string GetPersonList()
{
Person p1 = new Person { Name = "Rich", Age = "33" };
Person p2 = new Person { Name = "Rebekah", Age = "34" };
Person p3 = new Person { Name = "John", Age = "20" };
List<Person> p = new List<Person>() { p1,p2,p3};
JavaScriptSerializer oSerializer = new JavaScriptSerializer();
string jSon = oSerializer.Serialize(p);
return jSon;
}
What I want to do is access this on the client side onSuccess callback. here are my javascript functions..
function GetJson() {
json.UserService.GetPersonList(DisplayList, YouFailed);
}
function DisplayList(e) {
var vals = '(' + e + ')';
alert(vals);
}
function YouFailed() {
alert("fail");
}
Can someone point me to a decent tutorial or provide an explanation on how to accomplish this. I do not know the syntax to access the fields of an array of arrays.