我在调用jQuery函数时使用jQuery ajax加载模态时遇到了麻烦,它显示了对话框,但它没有显示任何由jQuery调用的模态。 我不知道我犯了哪个错误。有没有人可以帮我解决这个问题?
查看文件
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
jQuery调用
$(function(){
$('.gift').click(function(){
var product_id = $(this).attr('id');
//alert("asdfasdf");
$('#myModal').modal('show');
});
});
我打电话给ajax的地方:
<i id="<?php echo $row->id?>" class="fa fa-gift fa-lg text-danger ico gift" data-toggle="tooltip" data-placement="top" title="Send Gifts to your near ones"> 49</i>