Foursquare:无法从Server获取JSON数据

时间:2014-06-29 19:47:43

标签: javascript ajax json api foursquare

我可以从Foursquare获取授权码,但访问数据时遇到问题。

以下是相关代码:

    var getCheckin = function (access_token) {
        var  userrequest = { 
            userID: self, //stays
            limit: 100,  
            sort: 'newestfirst'  
        };

        var result = $.ajax({
            url: "https://api.foursquare.com/v2/users/self/checkins?oauth_token="+access_token,
            data: userrequest, //stays
            dataType: "jsonp",  //stays
            type: "GET"  //stays
        })
        .done(function(result){
            console.log("Looks like your ajax request was sent");
            getData(result);
        })

        .fail(function(jqXHR, error, errorThrown) { //stays common element
            var errorElem = showError(error); //stays common element
            $('.search-results').append(errorElem); //stays common element
        });

    };

    var getData = function(result) {
        console.log("Looks like your function was fired off");
        $('.checkin').html(result.response.checkins.count);
    };
});

以下是我正在使用的API端点:

https://developer.foursquare.com/docs/

从我的调试跟踪器中我收到以下错误:

(失败) 净:: ERR_FAILED

0 个答案:

没有答案