繁体   English   中英

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());
});

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM