我有一个函数可以将远程内容加载到 bootstrap 3 模态中,它使用 php 生成的记录集中的 id。 我似乎正在正确检索 id,但远程页面内容始终显示我点击的第一个 id
<script type="text/javascript">
$(document).ready(function(){
$('.pull-right').click(function(){
var id = this.id;
alert(id);
$('#myModal').modal({
remote: '/member_profile.php?MemberID='+id,
show: true
});
});
});
</script>
由于id生成正确,参数是否没有正确传递到远程php页面?
最佳答案
每次打开 AJAX 模式时都需要重置数据。这就是您要找的:
$('body').on('hidden.bs.modal', '#myModal', function() {
$(this).removeData('bs.modal');
});
关于javascript - 在 bootstrap 3 中将参数传递给远程模态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21457365/