jquery - How to show a hint while multiple ajax calls are running? -
i working on b2b version of magento shop. customers see list of products , input-fields. on change of input field, ajax-call ist set update cart.
now want show hint in cart sidebar cart updated long ajax calls running.
this ajax call:
$.ajax ({ url: url, type: 'post', data: qty, success: function(response) { $('.block-cart').replacewith($('.block-cart', response)); } });
and in cart sidebar i've got div set display: block while ajax call running.
i following code:
$(document).ajaxstart(function() { $('.hint').css({'display':'block'}); }); $(document).ajaxstop(function() { $('.hint').css({'display':'none'}); });
but not work reliable. div shown not...
i hope understand problem , make myself clear ;)
thanks smo
update:
i've got start behavior work. i've got missing div in other if statement. works. ajaxstop
fired early. when of posts running, hint disapears. have tried ajaxcomplete
no other effect.
i'll stay tuned , let guys date.
solved
hi there.
i have found sollution, works me , want share you.
i put ajax
queue. here code.
$(document).queue(function() { $('.hint').css({'display':'block'}); $.ajax ({ url: url, type: 'post', data: qty, success: function(response) { $('.block-cart').replacewith($('.block-cart', response)); $(document).dequeue(); } }); });
maybe else :) far,
smo
Comments
Post a Comment