现象如下:

python django-$.ajax status为200 却调用了error方法

 

python django-$.ajax status为200 却调用了error方法

python django-$.ajax status为200 却调用了error方法

报错如下:

python django-$.ajax status为200 却调用了error方法

原因:

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

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

解决办法:

第一种:将dataType:"json"去掉就ok了

第二种:后台返回结果转换为json返回,入下图所示:

python django-$.ajax status为200 却调用了error方法

 

参考网址:

https://blog.csdn.net/shuifa2008/article/details/41121269

相关文章:

  • 2021-07-19
  • 2022-12-23
  • 2022-12-23
  • 2021-12-16
  • 2022-12-23
  • 2021-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案