简体   繁体   English

JSONP无法正常工作?

[英]JSONP not working?

http://jsfiddle.net/baEXg/我不知道为什么它不起作用,“按钮”起作用,$。getJSON以下的任何东西都不起作用

If you want $.getJSON() request to be treated as JSONP you must specify a callback=? 如果要将$.getJSON()请求视为JSONP ,则必须指定callback=? in the URL. 在网址中。

It's even in the docs , consult them, they don't bite: 甚至在文档中 ,请教他们,他们不会咬人:

If the URL includes the string "callback=?" 如果URL包含字符串“ callback =?” (or similar, as defined by the server-side API), the request is treated as JSONP instead. (或类似,由服务器端API定义),该请求将被视为JSONP。

Here is a forked demo of your code . 这是您的代码分叉演示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM