开发者

Loading indicator for MVC3 unrobustive remote validation

I am doing the MVC3 unrobustive remote validation for checking username availability.

It works fine, but it takes quite some time load the validation message! Is there any way to show a spinner/user name available checking message during开发者_开发技巧 the transition?


You can do that with ajaxStart and ajaxComplete global methods.

ajaxStart : http://api.jquery.com/ajaxStart/

ajaxComplete : http://api.jquery.com/ajaxComplete/

If you would like to implement some specific loading indicators (for example, inside the text input), you need to bind some methods with JQuery and listen to the remote validation. Then, when it kicks in, you can fire the indicator start method and when it is done, you can get it back.


Use your ID attribute for activity_pane below

    jQuery('#activity_pane').showLoading();
jQuery('#activity_pane').load(
    '/path/to/my/url', 
    {},
    function() {
      //
      //this is the ajax callback 
      //
      jQuery('#activity_pane').hideLoading();
    }
);  

see http://contextllc.com/dev_tools/jQuery/showLoading/latest/jquery.showLoading.example.html

Another link showing how to do this here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜