I am calling the following C# method:
[WebMethod(true)]
public static List<ReadUserStructure> LoadFriends()
{
List<ReadUserStructure> returner = Friend.ReadAllFriends();
return returner;
}
With the following jQuery:
$.ajax({
type: "POST",
url: "Main.aspx/LoadFriends",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) { alert(msg.Count.toString()); }
});
I have a break point on the C# method and it hits it. stepping through the method the function works fine and, in my user, creates a list with a count of 2. But this list if not getting returned to the client. Any ideas?
The problem is the list won’t have a Count property in javascript. Instead, look for
msg.length