通过chrome查看response object内部结构
FB.api('/me/feed', 'post', { message: message_str }, function(response) { if (!response || response.error) { console.log(response.error); alert(response.error.message); // alert('Error occured'); } else { alert('Successfully published!'); }});
要找到response里面包含了哪些对象,可以在里面加入console.log(response.error),这样在chrome的Inspect Element里面的Console就可以看到object的结构了。
Ref:
http://stackoverflow.com/questions/10897544/fb-api-response-is-undefined
http://stackoverflow.com/questions/4743730/what-is-console-log-and-how-do-i-use-it