2011-11-27 40 views
5

要求我不能讓我的頭周圍遞延對象使用fb.api使用jQuery推遲

dfd = new $.Deferred(); 
FB.api('/me/posts?fields=id,story&access_token='+accessToken,function(response){   
    dfd.resolve(); 
    //Do something with the result 
}); 
dfd.done(alert(dfd.isDeferred())); 

從我的理解中,.done應該只有一次的請求已完成,回調設置對象爲解決火,然而,在請求完成之前,警報框會觸發錯誤。

我錯過了什麼?

回答

6

試着改變代碼的最後一行:

dfd.done(function(){ alert(dfd.isDeferred()); }); 

這是利用done()功能是如何documented in the jQuery API

+1

必須是簡單的,謝謝 –