对于在bootstrap3的
javascript模式中启动一个回调函数,我有点混乱.在正常的jquery.post中,你可以这样做,
$.post('path',{ something: something },function(data) { console.log(data); });
但是在引导3模态,我通过脚本触发模态,我这样做是基于我如何理解他们的网站的解释.
$('selector').modal('show',function() { //here comes the problem,I have a button in the modal in the html,my code //if the button was clicked inside this modal is.. $('#myButton').on('click',function() { console.log("this is a try"); }); });
解决方法
对于Bootstrap 3,事件现在是命名空间,所以模态的show事件将是show.bs.modal …
$('#myModal').on('show.bs.modal',function (e) { alert('modal show'); });