更新时间:2021-07-11 02:19:10
刚刚检查了***数据API参考文档,对于JSON和较新的JSON-C格式,它们都接受JSON-P,因此您可以指定通过callback
GET字符串参数进行回调.该链接将证明这是真的:
Having just checked the *** Data API reference documentation, for both JSON and the newer JSON-C formats, they both accept JSON-P, allowing you to specify the callback by the callback
GET string parameter. This link will demonstrate that this is true:
https://gdata.***.com/feeds/api/videos?q=baseball&v=2&alt=jsonc&callback=functionName
在这种情况下,长JSON对象返回包装在对functionName
的函数调用中.下一个URL是相同的调用,但使用的是旧的(且已过时)JSON格式:
The long JSON object return is wrapped in the function call to functionName
, in this case. The next URL is the same call, but in the older (and somewhat deprecated) JSON format:
https://gdata.***.com/feeds/api/videos?q=baseball&v=2&alt=json&callback=functionName
数据有些不同,但结果集相同,包装在另一个对functionName
的调用中.现在,这些调用是查询,用于获取与搜索参数(棒球")匹配的视频.但我敢肯定,他们会仔细阅读他们的参考文档(对于 JSON-C 和 JSON 格式)将产生您所需的内容,以使其能够正常工作,作为JSONP调用,并指定了回调在查询字符串中.
The data is a bit different, but same result set, wrapped in another call to functionName
. Now, these calls were queries to get the videos that matched the search param ("baseball"). But I'm sure perusing their reference documents (for the JSON-C and JSON formats) will yield what you need to make this work properly, as a JSONP call, specifying the callback in the query string.