FAQ:


Failed to load http://www.erpshop.com/index.php: Request header field Content-Type is not allowed by Access-Control-Allow-Headers in preflight response.

浏览器报错问题解决_ajax

解决方案:


ajax请求时,加上对服务器请求数据格式的限制:

contentType : "application/x-www-form-urlencoded" //发送给服务器的格式

注:


$.ajax contentType 和 dataType , contentType 主要设置你发送给服务器的格式,dataType设置你收到服务器数据的格式。