ajax请求失败但是返回200
来源:互联网 发布:ubuntu java环境搭建 编辑:程序博客网 时间:2024/05/16 09:58
jquery ajax请求成功,返回了数据,但是不进success的问题
1-------------------------dataType: "json"
The documentation states that jQuery:
Evaluates the response as JSON and returns a JavaScript object. (...) The JSON data is parsed in a strict manner; any malformed JSON is rejected and a parse error is thrown.
This means that if server returns invalid JSON with a 200 OK
status then jQuery fires the error function and set the textStatus
parameter to "parsererror"
.
Solution: make sure that the server returns valid JSON. It is worth noting that an empty response is also considered invalid JSON; you could return {}
or null
for example which validate as JSON.
you can check whether a json is valid or not on jsonlint.com
2----------------------------
1. 返回的数据类型一定要符合定义的数据类型。即如果你定义的 dataType 是 json 类型的,那么返回来的数据一定是 json 才可以,平且不然就会执行 error 里的程序块儿。
(1) 同时需要特别的注意返回的JSON数据是否是严格的JSON格式.
(2) 也应该严重关切当后台返回的是一个List 数据(List当中的数据是Json格式)时,有没脏数据即不是严格的JSON格式。
很隐蔽的可能是数据某一个字段中在开始或末尾含有特殊字符,以"回车键"、"Tab键"等
3----------------------------
http://stackoverflow.com/questions/6186770/ajax-request-return-200-ok-but-error-event-is-fired-instead-of-success
http://my.oschina.net/adwangxiao/blog/78509
http://qianduanblog.com/post/jquery-ajax-status-success-200.html
http://www.googto.com/?q=ajax%20%E8%AF%B7%E6%B1%82%E5%A4%B1%E8%B4%A5%E4%BD%86%E6%98%AF%E8%BF%94%E5%9B%9E200
- ajax请求失败但是返回200
- ajax 请求返回200 但是不进success--2
- ajax 请求返回200 但是不进success--2
- ajax 跨域请求返回200 但是不进success--1
- ajax跨域,使用json,crossDomain,请求返回状态200,但是走的error的原因以及解决方法
- ajax提出post请求,请求正常执行,但是返回error错误
- ajax 返回失败
- Ajax请求正常返回了数据、但是总是走error分支
- jquery ajax请求成功,返回了数据,但是不进success的问题
- Ajax请求在后台已执行,但是返回前台404/403
- jquery ajax请求成功,返回了数据,但是不进success回调函数的问题
- JQUERY AJAX请求成功,返回了数据,但是不进SUCCESS的问题 【转】
- JQUERY AJAX请求成功,返回了数据,但是不进SUCCESS的问题
- JQUERY AJAX请求成功,返回了数据,但是不进SUCCESS的问题
- jquery ajax请求成功,返回了数据,但是不进success的问题
- JQUERY AJAX请求成功,返回了数据,但是不进SUCCESS的问题
- ajax 请求回到200 但是不进success-2
- ajax json 请求返回
- CheatSheet – 显示当前程序快捷键列表[Mac]
- 基于EF4.1的异构数据库访问组件
- 《Contrast Limited Adaptive Histogram Equalization》
- Verilog 中连接符使用注意事项
- JavaScript的那些坑之事件冒泡
- ajax请求失败但是返回200
- ORA-00445: background process " " did not start after 120 seconds
- VS2008 ---- VS2013各个版本下载地址
- 使用CSS制作Loading加载Icon
- iOS选择相册中的视频并且展示视频第一帧的图片
- 常用正则表达
- Property Animation属性动画,还用补间动画你就out了
- m版页面判断安卓与ios系统
- OpenCV在未知相机内参数情况下的立体图像矫正方法及注意事项