更新时间:2022-06-24 15:10:21
通过添加您要使用使用XMLHtt $ P脚本元素,而不是为JSON的请求作出了JSONP请求的回调参数,你告诉jQuery的$ pquest。
By adding a callback argument, you are telling jQuery that you want to make a request for JSONP using a script element instead of a request for JSON using XMLHttpRequest.
JSONP不是JSON。这是一个JavaScript程序。
JSONP is not JSON. It is a JavaScript program.
更改您的服务器,以便其输出正确的MIME类型JSONP是应用程序/ JavaScript的
。
Change your server so it outputs the right MIME type for JSONP which is application/javascript
.
(当你在这,停止告诉jQuery的是你期待的JSON因为这是矛盾的:数据类型:JSONP
)。
(While you are at it, stop telling jQuery that you are expecting JSON as that is contradictory: dataType: 'jsonp'
).