我有一個HTML/PHP表單與多個選擇框。在提交表單時,我調用jquery函數來創建一個查詢字符串,其中包含選擇框和其他變量的變量,並將此查詢字符串傳遞給jQuery Tools Overlay以在外部加載它。jQuery覆蓋查詢字符串沒有得到刷新
疊加層正確加載並使用正確的查詢字符串顯示頁面。當我關閉覆蓋層時,出現問題,更改一些選擇框值並重新提交表單。外部頁面仍然被加載,但查詢字符串沒有刷新,它仍然與打開覆蓋頁面的第一個實例相同。
以下是我的jQuery代碼:
$(function(){
$('#form').submit(function(){
. //code to get $str which contains the querystring Example $str="page='abc'&sub='xyz'"
.
$go='displaygroups.php?'+$str;
alert($go);//just to check if querystring is correct.
dispgrps($go);
return false;
});
function dispgrps($go){
$("#overlay").overlay({
// custom top position
top: 100,
// some mask tweaks suitable for facebox-looking dialogs
mask: {
color: '#d1eaf1',
loadSpeed: 10,
opacity: 0.9
},
// load it immediately after the construction
load: false,
onBeforeLoad: function() {
// grab wrapper element inside content
var wrap = this.getOverlay().find(".contentWrap");
// load the page specified in the trigger
wrap.load($go);
},
onClose:function(){
$('.contentWrap').html('Loading...');
}
});
$("#overlay").overlay().load();
}
});
,如果我第一次和頁面=「1」提交從選擇框,然後連上改變選擇的值要說頁=「2」和resubmiting形式,外部頁面displaygroups.php仍然反映爲1
我只是在displaygroups.php呼應值進行測試頁:
if(isset($_GET['page'])) echo $_GET['page'];
疊加CSS元素
<div class="apple_overlay" id="overlay">
<!-- the external content is loaded inside this tag -->
<div class="contentWrap">Loading...</div>
</div>
請大家幫忙。謝謝。
編輯:無法弄清楚,所以我改變了代碼,使其鏈接,而不是表單提交。它現在有效。
感謝您的回覆Dansmeek,我想實現你的建議,但它沒有工作。查詢字符串仍然不會刷新。 – Ritz