The jquery version causes Ajax to not perform success callback functions _ajax related

Source: Internet
Author: User
Tags json numeric value
It's not the first time you've been using AJAX to request data (and that's what it's all about), just yesterday I ran into a problem? The project needs to use Ajax to make the data request, so envelope the AJAX code copy to the project, front-end, background data processing finished, testing (thought can rest under), who knows the data successfully returned, the front-end did not complain, backstage is also true, obstinately did not perform success callback function, The heart is half cold.

The next step is to find the reason, look at the original code, Baidu, JSON format check, and finally found that the culprit is actually the jquery version of the cause of the problem.

jquery version: Jquery-1.9.0.min.js

As the jquery version increases, there is a strict requirement for the JSON format, and the original return message {success:true,id:1,result: "OK"} is no longer applicable in the high version, the following format is required
Copy Code code as follows:

{"Success": TRUE, "id": 1, "result": "OK"}

Summarize:

Key: Enclose in double quotes

Value:1. Numeric value, Boolean type does not use double quotes

2. Strings are enclosed in double quotes

Format: {success:true,id:1,result: ' OK '} does not pass

Format: {"Success": TRUE, "id": 1, "result": "OK"}
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.