In the future, we chose jquery as the registration page. I don't know what version jquery is now. The JS Code I wrote references jquery1.3.2, while Comrade wheat uses jquery1.4.2 for the static interface. A problem was found during use. In versions 1 and 3.2, the success function can be responded, but in version 1.4.2, the success function is not responded, and the error function is returned. I searched the internet to find out that it was a version issue!
In Versions later than 1.4, the format of JSON returned data must be:
Code:
- After query 1.4, the JSON format is changed to strict.
- The {"key": "value", "key": "value"} must be in this format "};
- Like the original
- {Key: value, key: Value}
- {'Key': 'value', 'key': 'value '}
- This is all incorrect and not standard, so jquery Returns Error
Jquery
Code:
- $. Ajax ({
- Type: "Post ",
- URL: '/ZZB/register/register_check.jsp ',
- Cache: false,
- Datatype: 'json ',
- Data: {nickname: $ ("# nickname"). Val ()},
- Success: function (result ){
- Alert ('success ');
- },
- Failure: function (result ){
- // Console. Log (result );
- },
- Error: function (){
- Alert ('error ');
- }
- });
Discussion: http://topic.csdn.net/u/20100310/17/4278ccd1-c5b4-41af-975e-65fba61ba00d.html