0
我想使用JavaScript FB.api发布图像到用户墙。图像是从一个java servlet动态生成的,但是由于图像生成之前的异步行为,它会将控件传递到块下面以将图像发布到Facebook部分。 我想要么脸谱图API调用后使用servlet图像
- 我该如何使fb.api发布到Facebook从servlet调用?
- 如何处理这种行为,以便在图像生成之前控制权不会通过下方?
note servlet正在工作文件并生成图像。
var imgURL="http://xxx.xxx.xxx.xxx:8084/myapps/app1?monthly="+monthly+"&recent="+recent+"&likes="+likes;
//var imgURL="http://xxx.2xx.xx6.1x8:8084/WebApplication6/image";
alert('image');
//var imgURL="https://graph.facebook.com/100000329585395/picture";
var img = document.createElement('img');
img.src =imgURL;
document.body.appendChild(img);
FB.api('/me/photos', 'post', {
message:'image',
url:imgURL
}, function(response){
alert('here');
if (!response || response.error) {
alert('Error occured'+response.error);
} else {
var postId = response.id;
alert(postId);}
});