modal dialog - Ajax calls duplicate in jQuery loop -
modal dialog - Ajax calls duplicate in jQuery loop -
the function creates popover (bootstrap)
$(document).ready(function() { //loop there pages more 1 popover $('.pop').each(function() { var $elem = $(this); $elem.popover(param); //triggers popover $elem.on('click', '.add_to_top', function() { top_modal.modal('show'); //opens modal form //inside modal form $(top_modal).on('click', '.add_top_submit', function() { //this submits form ajax phone call }); }); }); });
the issue if example, submit form button clicked , throws error, resubmitted ajax requests sent twice. everytime .add_top_submit clicked on modal triggered different popover, ajax phone call made 1 time more.
if there more 1 popover on page , modal triggered 2 different popovers, ajax requests goes through multiple times.
is there way "reset" on()
clicked if first time?
is there way "reset" on() clicked if first time?
you can utilize off() , on() reset event handlers. http://api.jquery.com/off/
jquery modal-dialog popover
Comments
Post a Comment