Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 解析json“;meta";从运球api_Jquery_Json - Fatal编程技术网

Jquery 解析json“;meta";从运球api

Jquery 解析json“;meta";从运球api,jquery,json,Jquery,Json,我从Dribble api中获得了以下json: /**/foo({ "meta": { "X-RateLimit-Limit": 60, "X-RateLimit-Remaining": 59, "X-RateLimit-Reset": 1429948020, "Link": [ [ "https://api.dribbble.com/v1/users/234460/shots?access_token=accesstoken\u

我从Dribble api中获得了以下json:

/**/foo({
  "meta": {
    "X-RateLimit-Limit": 60,
    "X-RateLimit-Remaining": 59,
    "X-RateLimit-Reset": 1429948020,
    "Link": [
      [
        "https://api.dribbble.com/v1/users/234460/shots?access_token=accesstoken\u0026callback=foo\u0026page=4\u0026per_page=2",
        {
          "rel": "next"
        }
      ],
      [
        "https://api.dribbble.com/v1/users/234460/shots?access_token=accesstoken\u0026callback=foo\u0026page=2\u0026per_page=2",
        {
          "rel": "prev"
        }
      ]
    ],
    "status": 200
  },
  "data": [
    {
我可以从我的“playerShots”对象中的“数据”中获得我所需的大部分内容,你可以看到从末尾开始,如:

    $.each(playerShots.data, function (i, shot) {
        html.push('<div class="%id%imageFrame">');
        html.push('<img src="' + shot.images.teaser + '" alt="' + shot.title + '" data-url="' + shot.html_url + '" />');
它向我显示了这一点,但没有“链接”的迹象

所以我不能这么做:

JSON.stringify(playerShots.meta.Link) 
请帮忙。。我如何获得这些链接。。?最好参考“下一个”和“上一个”,这样我就知道我有哪些了。

使用

var link = result.meta.Link;
var nextLink = link[0][0];
var prevLink = link[0][1];

result.meta.Link
返回数组结果

它位于一个数组中,因此您必须执行类似于
meta.Link[0][0]
的操作-这应该会得到第一个结果,
meta.Link[0][1]
应该得到下一个结果;nextLink=link[0][0];prevLink=链接[0][1]我问的问题完全正确。这让我意识到我不可能在结果中找到“链接”。因此,调试并发现url字符串中调用页码的变量为空。因此,结果的“元”中没有返回“链接”,谢谢大家。
JSON.stringify(playerShots.meta.Link) 
var link = result.meta.Link;
var nextLink = link[0][0];
var prevLink = link[0][1];