Pinterest API UncaughtReference异常

时间:2016-03-07 05:44:53

标签: javascript pinterest

有人可以解释如何正确访问和解析用户Pinterest板吗?我正在尝试使用Pinterest API获取用户板上的引脚列表,但我在下面的注释行中出现UncaughtReference错误。

<script>
    window.pAsyncInit = function() {
        PDK.init({
            appId: "xxxxxxx",
            cookie: true
        });
    };

    (function(d, s, id){
        var js, pjs = d.getElementsByTagName(s)[0];
        if (d.getElementById(id)) {return;}
        js = d.createElement(s); js.id = id;
        js.src = "//assets.pinterest.com/sdk/sdk.js";
        pjs.parentNode.insertBefore(js, pjs);
    }(document, 'script', 'pinterest-jssdk'));

var pins = [];
var board_id='yyyyy';
PDK.request('/boards/'+board_id+'/pins/', function (response) {// error here
  if (!response || response.error) {
    alert('Error occurred');
  } else {
    pins = pins.concat(response.data);
    if (response.hasNext) {
      response.next();
    }
  }
});

document.write(pins);
</script>

0 个答案:

没有答案