My webmethod is quite simple:
<WebMethod(Description:="Does something.")> _
<ScriptMethod(ResponseFormat:=ResponseFormat.Json)> _
Public Shared Function ReturnJSONData() As Person
Dim guy As New Person
guy.Name = "Joe"
guy.Age = 8
Return guy
End Function
Below is where I am making an ajax call to the method:
function GetPerson() {
PageMethods.ReturnJSONData(OnWSRequestComplete1);
}
function OnWSRequestComplete1(result) {
alert(result.d);
}
Although, in tools like firebug, I can clearly see the JSON data:
{"d":{"__type":"Person","Name":"Joe","Age":8}}
But, when I try to display the value by using "alert(result.d)", it shows as undefined. Can anyone identify what might be missing here?