ASP. NET uses ext and newtonsoft. JSON for Ajax Asynchronization

Source: Internet
Author: User

1. Add corresponding attributes for the object class. Newtonsoft. JSON can easily serialize an object to a corresponding JSON string. If you need to customize the specified property serialization, you need to add the corresponding property such as ignore, then, the corresponding string generated after serialization does not include the field values that the user does not want to appear.

2. serialize the object class and return it. EXT sends an Ajax request to Handler through JS, and handler serializes the result into JSON and returns it.

3. Ext receives the JSON string result and uses decode to parse JSON to generate the corresponding object. The operation object displays the expected result.

4. Ext receives user input on the page, generates corresponding objects in JS, and assigns corresponding values according to user input, then encode generates a JSON string for the expected object (ext has good support for JSON), sends an Ajax request to the server, and the server receives the corresponding JSON string, deserialization generates corresponding entity classes to complete user operations.

TIPS: when you enter the page, you can write the JSON of the object class to the page. In JS, you can directly decode the object class.

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.