自举3动态模式 - Ajax内容缓存问题 [英] bootstrap 3 dynamic modal - ajax content caching issue
问题描述
我需要一个动态的引导模式,这取决于我在同一个域中的结果需要来找我的引导模式发送到外部页面的ID。该系统的工作原理,当你第一次加载页面,但如果我点击另一个链接,打开不同的模式,我应该看到不同的结果,但只显示第一个结果......它基本上缓存的结果。
I need a dynamic bootstrap modal, depending on the id I sent to an exterior page in the same domain the result needs to come to me in a bootstrap modal. The system works when you first load the page but if I click on another link to open different modal I should see different result but it only shows the first result...which is basically caching the result.
下面是我做了什么。我也试着发送时间戳等,但它仍然是相同的。
Here is what I have done. I also tried sending timestamp etc but it is still the same.
<a href='modal_window.php?mpage_id=$mpage_id' mpage_id='$mpage_id' data-toggle='modal' data-target='#myModal'> open modal </a>
这是我的模式在同一页上
This is my modal on the same page
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria- labelledby="myModalLabel" aria-hidden="true">
</div>
<!-- /.modal -->
所以,我怎么能不加载缓存的结果远程内容?
So how can I load remote content without caching the result?
推荐答案
使用下面的JavaScript每次显示的模态时清除缓存:
Use the following JavaScript to purge the cache every time the modal is displayed:
$('#myModal').on('shown.bs.modal', function () {
$(this).removeData('bs.modal');
});
另外值得一提的是,远程模态被去precated 在引导V3.2.1并将引导V4中完全删除。
It's also worth noting that remote modals are being deprecated in Bootstrap v3.2.1 and will be removed entirely in Bootstrap v4.
这篇关于自举3动态模式 - Ajax内容缓存问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!