我想从 if else 块中设置 stat 的值,但是当我设置它并警告它时,它对我说“未定义”。如何设置 stat 的值。这是我的代码。
deleteComment = function(postId){
var stat = "Don't Know";
FB.api(postId, 'delete', function(response) {
if (!response || response.error) {
stat = "Error2";
} else {
stat = "Deleted"
}
});
alert(stat);
};
提前致谢