2012-07-31 56 views

回答

2

是的,它可以。看這裏下的「回調」:

http://spinejs.com/docs/ajax

基本上可以阻止用戶界面在任何時候,我做的事情,只是不能推遲到服務器。請注意,我甚至不使用ajaxSucess()事件,而僅使用事件的自定義綁定。下面是元編程中的一個示例用例:

Bind 'clickHandlerFinish' event to clickHandlerFinishWork() 
Bind 'click' event on button a to clickHandler() 
User clicks on button a 
clickHandler() gets fired 
clickHandler disables the button and blocks the UI 
clickHandler makes an AJAX call to the server to do work 
(Remember UI is still blocked) 
AJAX call finally returns, and fires the clickHandlerFinish() callback 
clickHandlerFinish() unblocks the UI, re-enables the button, and presents the new changes 

我已經在一些實例上成功地使用了它。對我很好!