I Have an object 'Person' in C#, and I want to return this object in WebMethod.
[WebMethod]
public static Person LoadPerson(string id)
{
return sdb1.Persons.Where(x =>x.PersonID.ToString().Equals(id)).FirstOrDefault();
}
and in JS:
function LoadPerson(id) {
PageMethods.LoadPerson(id,onSucess, onError);
function onSucess(result) {
alert();
}
function onError(result) {
alert('Something wrong.');
}
}
How can I return this object? I want for example to alert onSucess the Person fullName. (there is Attribute field 'FullName')
Thank you!