javascript - setTimeOut AFTER jQuery form submit -


here deal: have form, takes quite time submit, because i'm waiting third party web services. i'm trying achieve is, after submit button clicked, gets disabled, assigned special class , if takes more 5 seconds submit form, notice displayed.

i've came this:

$('#register_index_button').click(function(){ $(this).addclass('bt_button_loader'); $(this).val('please wait'); $(this).attr('disabled', 'disabled'); $('#register_index_form').submit();  //it takes more 5 seconds, display notice settimeout(function() {     $('#notice').html('still waiting ...'); }, 5000); }); 

everything works fine, except timeout function. guess after submit form jquery, else after ignored?

thank help!

try attaching event handler on form "submit" event. put timeout event handler function.

(https://developer.mozilla.org/en-us/docs/web/events/submit)

$('#register_index_form').on('submit', function(){      settimeout(function() {          $('#notice').html('still waiting ...');      }, 5000);  }); 

Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -