1. WebService.asmx: Process business data and generate Person entity class data in the GetPerson method for JqueryRequest.aspx to call. The code is as follows:
[WebMethod]
public Person GetPerson(string name, int age, string address)
{
Person p = new Person()
{
Name = name,
Age = age,
Address = address
};
return p;
}
2. Person.cs entity class:
public class Person
{
private string _name;
public string Name
{
get { return _name; }
set { _name = value ; }
}
private int _age;
public int Age
{
get { return _age; }
set { _age = value; }
}
private string _address;
public string Address
{
get { return _address; }
set { _address = value; }
}
}
3. AjaxRequest.aspx By clicking the button, request the GetPerson(string name, int age, string address) method of WebService.asmx to obtain the Person entity data. The code is as follows: