我一直试图用jquery获取facebook页面提要。我已经包含了我已经尝试过的代码
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script>
$(document).ready(function () {
$menuLeft = $('.pushmenu-left');
$nav_list = $('#nav_list');
$nav_list2 = $('#nav_list2');
$nav_list.click(function () {
$(this).toggleClass('active');
$('.pushmenu-push').toggleClass('pushmenu-push-toright');
$menuLeft.toggleClass('pushmenu-open');
});
$nav_list2.click(function () {
alert("clicked");
window.fbAsyncInit = function () {
FB.init({
appId: '1647252837xxxxx',
status: true,
cookie: true,
xfbml: true
});
FB.Event.subscribe('auth.authResponseChange', function (response) {
alert("clicked 2");
if (response.status === 'connected') {
alert("connected");
testAPI();
} else if (response.status === 'not_authorized') {
alert("connected");
FB.login();
} else {
alert("connected");
FB.login();
}
});
};
(function (d) {
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
if (d.getElementById(id)) { return; }
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
ref.parentNode.insertBefore(js, ref);
}(document));
function testAPI() {
console.log('Welcome! Fetching your information.... ');
FB.api('/me', function (response) {
console.log(JSON.stringify(response));
var name = response.name;
$.get('https://graph.facebook.com/111222778066/feed?access_token=ba965d29c16c605d252f5f500cf58baa',
function (data) {
}, "jsonp");
});
}
});
});
</script>
我在控制台中找不到任何错误。我不知道要采取的任何进一步措施。
任何帮助都将不胜感激。