我有一個三級jstree.After作出所有選擇後,我調用displayCount()方法來顯示基於選擇的正確的搜索結果計數。現在,當我取消選中一個選擇時,它將徹底檢查所有節點以保持適當的選定結構,然後調用displayCount()方法。但問題是,在取消選中節點之前,它已經調用了displayCount()方法。我得到錯誤的計數。方法調用的順序如下: -如何維護順序的jQuery方法調用?
UnchekSelectedNodes(){
// nodes are getting unchecked depends on parent-child relation.
// purely DOM structure update operation.
}
displayCount(){
// ajax call to show proper count based on selected nodes/checkboxes
}
checkForEmptyDiv(){
// if it becomes no selected hide the div.
}
問題is..always displayCOunt()UnchekSelectedNodes完成()operation.I試圖與法chainng取決於flag.It不起作用之前被調用。
任何解決方案?
http://api.jquery.com/jQuery.ajax看到'async' – user2264587 2013-04-20 15:26:15