【问题标题】:How to access data from Wikipedia OpenSearch API which is in JSON format?如何从 Wikipedia OpenSearch API 访问 JSON 格式的数据?
【发布时间】:2016-07-22 18:58:01
【问题描述】:

【问题讨论】:

  • 你想达到什么目的?

标签: javascript jquery html json wikipedia-api


【解决方案1】:

首先,您需要在查询字符串中将 'format=jsonfm' 更改为 'format=json'。然后你可以使用 jQuery 获取数据,例如:

$.ajax({
    url: "https://en.wikipedia.org/w/api.php?action=opensearch&format=json&search=Robert&limit=6&suggest=1&redirects=return&callback=ttt",
    jsonp: "callback",
    dataType: "jsonp",
    success: function( response ) {
        console.log( response );
    }
});

你会得到你的数组数组

【讨论】:

    猜你喜欢
    • 2021-01-01
    • 2017-05-10
    • 2018-04-18
    • 1970-01-01
    • 2019-11-02
    • 2020-05-28
    • 2022-10-01
    • 1970-01-01
    • 2017-12-08
    相关资源
    最近更新 更多