jquery $.ajax status为200 却调用了error方法

来源:互联网 发布:mac怎么关闭软件 编辑:程序博客网 时间:2024/06/01 09:09
[html] view plain copy
  1. <span style="font-size:18px;">$.ajax({  
  2.             url: "",  
  3.             type: "POST",  
  4.             data: {  
  5.                 flow_id : "1233",  
  6.                 flowchart : "test"  
  7.             },  
  8.             error: function(ht){  
  9.                 alert("系统错误,请重试");  
  10.             },  
  11.             dataType: "json",  
  12.             success: function(data){  
  13.                 if(data == "ok") {  
  14.                     alert("保存成功");  
  15.                 } else {  
  16.                     alert("系统错误,请重试");  
  17.                 }  
  18.             }  
  19.         });</span>  


查看http STATUS 是200,但是回调的却是error方法

查了下资料,应该是dataType的原因,dataType为json,但是返回的data不是json格式

于是将dataType:"json"去掉就ok了

4
阅读全文
0 0
原创粉丝点击