Use jquery to return all types of returned data (string, set (list), and class) in JSON data format. Why use result. D (jquery ajax to return data using. d)

Source: Internet
Author: User
Tags javascript array

Source: http://www.cnblogs.com/xiaowu/archive/2011/09/07/2169283.html

Use jquery to return various types of data (String, set (list <>), Class)Why is result. D used for returning in JSON data format?

here we'll talk about JSON

JSON is simply a JavaScript Object or array.

JSON Form 1: JavaScript Object {" firstname ":" Brett "," lastname ":" McLaughlin "," email ": "aaaa"}

JSON Form 2: JavaScript Array [{" firstname ":" Brett "," lastname ":" McLaughlin "," email ": "aaaa" },

{"Firstname": "Jason", "lastname": "hunterwang", "email": "BBBB"}]

Of course, JavaScript arrays and objects can be nested. For example, in Form 1, "Brett" can be replaced with a JS array or JS object. Which form does Microsoft Ajax return? It is the first one.

By default, the Microsoft framework returns a {"D": "data returned in the background"} Here we use the test in the above example as follows:

If the string type is returned in the above example, Firefox debugging is as follows:

Firefox debugging is as follows:

The returned data is stored in the D attribute of the JS object. That's why we always use result. D to retrieve the data returned by the Microsoft framework.

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.