Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 822
PradeepN Avatar asked Dec 22 '22 08:12

PradeepN


2 Answers

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.

like image 192
tugberk Avatar answered Jan 10 '23 15:01

tugberk


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.

like image 35
RickAndMSFT Avatar answered Jan 10 '23 15:01

RickAndMSFT