Jquery .load() 每次页面加载只发送一次 POST 参数


Jquery .load() sends POST parameters only once per page load

我有这个脚本:

  $('#openBtn').click(function(){
       $(".modal-body").load("/show.php?fFuehIFj1L0vS6Hp", {oi: $("#oi").val(), txtid:    $("#txtid").val()}, function(result){
        $('#myModal').modal({show:true});
     });
});

和这个 html:

 <a href="#" class="btn" id="openBtn">Open modal</a>
 <div id="myModal" class="modal hide fade" tabindex="-1" role="dialog">
<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal">×</button>
        <h3>Modal header</h3>
</div>
<div class="modal-body">
    <p>My modal content here…</p>
</div>
<div class="modal-footer">
    <button class="btn" data-dismiss="modal">Close</button>
</div>

我想发送 POST 变量并在每次单击时检索远程页面,但现在它仅在第一次单击时发送 POST 变量,之后我必须刷新我的页面。

你的意思是JavaScript上的hashchange吗?就像这样

site.com/blah#content=1

function hash()
{
var hash = window.location.href;
hash = split("#", hash);
hash = hash[1]; // this is hash param
return hash;
}
$(window).on('hashchange', function() {
$("#page").load("index.php?"+hash());
});
$(window).ready(function() {
$("#page").load("index.php?"+hash());
});