同样的Ajax请求,在chrome可以得到正常的response,但是在safari会返回"尝试载入资源时发生错误"。

原因:

  1. 可能是ajax的datatype没带。
  2. 如果你表单提交的button的type为“submit”,改为button或者其他类型即可,因为button 的类型为submit时,此按钮会提交表单数据给服务器。未指定时,此值为默认值,或者此属性动态变成空值或者无效值。

解决办法:

  1. ajax请求加上 “datatype”:“json”
  2. 将button的type改为"button"

报错信息如下图:

Ajax请求在safari浏览器不行,chrome可以正常请求

Ajax请求在safari浏览器不行,chrome可以正常请求

相关文章:

  • 2022-12-23
  • 2021-12-24
  • 2021-10-06
  • 2021-11-01
  • 2021-09-05
  • 2021-12-12
  • 2021-08-07
  • 2021-09-01
猜你喜欢
  • 2022-01-17
  • 2022-12-23
  • 2021-12-29
  • 2021-10-12
  • 2021-11-04
  • 2021-10-28
相关资源
相似解决方案