call data-toggle="modal" from function code example
Example 1: call function on modal open
$('#myModal').on('shown.bs.modal', function (e) {
// do something...
})
Example 2: how to show bootstrap modal
<script>
var myModal = new bootstrap.Modal(document.getElementById('ModalID'))
myModal.show()
</script>