$(document).ready(function () { initDuplicateOtherToOtherMerchant(); }); function initDuplicateOtherToOtherMerchant() { $('.duplicate-modal-action').on('click', function (e) { $btn = $(this); e.preventDefault(); $.ajax({ url: $btn.prop('href'), method: "POST", dataType: "json", success: function (response) { $('body').append(response.data); SovTools.log($('#carac-modal-duplicate')); $('#carac-modal-duplicate').modal('show'); //initDuplicateModal(); } }); }); } function initDuplicateModal(){ $('#carac-button-visit-merchant').on('click', function (e){ SovTools.log($('form[name="duplicate_to_other_merchant_form"]')); $.ajax({ url: $btn.prop('href'), data: $('form[name="duplicate_to_other_merchant_form"]').serialize(), method: "POST", dataType: "json", success: function (response) { } }); }); }