Ajax请求在chrome可以正常,在firefox或者safa

2018-07-21  本文已影响0人  Brookyear

同样的Ajax请求,在chrome可以得到正常的response,但是在firefox或则会safari会返回"Fail to load resource"。

原因:

1.可能是ajax的datatype没带。

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

解决办法:

1.ajax请求加上 "datatype":"json"

2.将button的type改为"button"

上一篇 下一篇

猜你喜欢

热点阅读