jquery - Click events running twice after re-opening the bootstrap modal -


currently working on codeigniter apps

i loading view in bootstrap modal using ajax, loaded view has jquery events further have ajax calls. problem getting when click on button(which execute ajax) triggers once after closing modal , reopening clicked event running twice.

$(document).on('click','.open_form',function(e){ e.preventdefault(); var task = $(this).attr('id'); $.ajax({     type: "post",     url: "<?php echo site_url();?>client/getmodalview",     data: {view:'invoice','<?php echo $this->security->get_csrf_token_name(); ?   >':'<?php echo $this->security->get_csrf_hash(); ?>','task':task},     cache: false,     context: document.body,     beforesend:function(){        if(task == 'expense')        {            $('.modal-title').html('add expense');        }else if(task == 'uploadexpense'){            $('.modal-title').html('upload expense');        }else if(task == 'newdividend'){            $('.modal-title').html('add new dividend voucher');        }else if(task == 'banks'){            $('.modal-title').html('upload bank statement');        }else{            $('.modal-title').html('add invoice');        }        $('.modal-body').html('<img src="<?php echo site_url();?>assets/images/loading.gif"/>');     },     error:function(msg){     },     success:function(msg){         msg = json.parse(msg);         var html = '';         $('#script').html(msg['script']);         if(msg['file'] != '')         {             html = msg['file'];         }          html += msg['html'];        $('.modal-body').html(html);     } });  return false;        

});


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -