在Bootstrap 3中将参数传递给远程模态 [英] passing a parameter to remote modal in bootstrap 3
问题描述
我具有将远程内容加载到bootstrap 3模态中的功能,该模态使用php生成的记录集的id. 我似乎在正确检索ID,但是远程页面内容始终显示我单击的第一个ID
I have a function to load remote content into a bootstrap 3 modal, which uses the id from a php generated recordset. I seem to be retrieving the id correctly, but the remote page content always shows the first id i clicked on
<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页面吗?
As the id is being generated correctly, is the parameter not being passed to the remote php page correctly ?
推荐答案
您每次打开AJAX模式时都需要重置数据.这就是您要寻找的:
You need to reset the data any time you open an AJAX modal. This is what you're looking for:
$('body').on('hidden.bs.modal', '#myModal', function() {
$(this).removeData('bs.modal');
});
$('body').on('hidden.bs.modal', '#myModal', function() {
$(this).removeData('bs.modal');
});
这篇关于在Bootstrap 3中将参数传递给远程模态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!