【问题标题】:facebook error function response is not defined [closed]facebook错误函数响应未定义[关闭]
【发布时间】:2015-04-10 10:06:46
【问题描述】:
    if (response.status === 'connected') {
        $.ajax({

            url: 'https://graph.facebook.com/oauth/access_token',
            type: 'GET',
            data:'grant_type=fb_exchange_token&client_id="done"&client_secret="done"&fb_exchange_token="done"',  
            success: (function (response) {  alert(reponse);      })
        });    testAPI();
    }

我的 ajax 查询成功传递数据:url:但函数响应出错

未捕获的引用错误:未定义响应

$.ajax.success
c.extend.ajax.w.onreadystatechange

【问题讨论】:

    标签: javascript ajax facebook facebook-graph-api facebook-javascript-sdk


    【解决方案1】:

    也许您应该使用response 变量而不是未定义的reponse

    if (response.status === 'connected') {
        $.ajax({
    
            url: 'https://graph.facebook.com/oauth/access_token?grant_type=fb_exchange_token&client_id={APP_ID}&client_secret={APP_SECRET}&fb_exchange_token={ACCESS_TOKEN}',
            type: 'GET'
            success: function (response) {  
                alert(response);
            }
        });    
        testAPI();
    }
    

    另外,请修复您的呼叫,因为您发送的请求不正确。此外,将{} 之间的值替换为实际值。

    【讨论】:

    • 加载资源失败:服务器响应状态为 400(错误请求)仍然显示
    • 因为你没有说你想要做什么,所以很难帮助你。我认为您不应该为 GET 请求传递 data 属性。改变了我的答案。您需要将{} 中的值替换为实际值...
    • 完成谢谢。我正在获得 facebook 客户端的长期用户访问令牌。我做到了,谢谢
    • 那么请接受我的回答。
    • 你能告诉我如何使用 c sharp 和 facebookAPI dll 获取长期用户访问令牌
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-19
    • 2013-03-02
    • 1970-01-01
    • 1970-01-01
    • 2012-12-08
    • 1970-01-01
    相关资源
    最近更新 更多