Jquery Ajax learning instance 4 sends a request to WebService and returns an asynchronous call to the object.

Source: Internet
Author: User

1. WebService. asmx:
Process business data and generate the person Entity Data in the getperson method for calling jqueryrequest. aspx, Code As follows: Copy code 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: copy Code the code is as follows: public class person
{< br> private string _ name;
Public string name
{< br> get {return _ name ;}< br> set {_ name = value ;}
}< br> private int _ age;
Public int age
{< br> get {return _ age ;}
set {_ age = value ;}< BR >}< br> private string _ address;
Public String address
{< br> get {return _ address ;}< br> set {_ address = value ;}
}< BR >}

3. ajaxrequest. aspx
click the button to request WebService. the getperson (string name, int age, string address) method of asmx obtains the object data of person. The Code is as follows: copy Code the code is as follows:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.