假设我有info.php
包含用户信息(id、姓名、年龄等)的页面。
在此页面上,有一个“编辑”按钮,可将用户带到一个表单,edit.php
以便他们可以更改他们的信息。该表单通过 $_POST 填充 id、姓名、年龄等。
edit.php
有一个“更新”按钮,可以info.php
用更新的数据发回。这一切都很好。
但是,当我尝试edit.php
在 jQuery Tools Overlay 弹出窗口中加载时,会edit.php
出现表单,但不会传递变量。相反,它们都显示为“未定义”。
我不确定在哪里放置所需的href
元素,以便将我的变量传递给edit.php
覆盖层内的时间。
有任何想法吗?
<form action="edit.php" method="post">
<input type="hidden" name="edit" value="yes" />
<input type="hidden" name="id" value="<?php echo $row[1] ?>" />
<input type="hidden" name="name" value="<?php echo $row[2] ?>" />
<!-- this is the required href to trigger overlay -->
<a href="edit.php" rel="#overlay" style="text-decoration:none">
<input type="submit" value="Edit"/>
</a>
</form>
<div class="apple_overlay" id="overlay">
<!-- the external content is loaded inside this tag -->
<div class="contentWrap"></div>
</div>
<!-- make all links with the 'rel' attribute open overlays -->
<script>
$(function() {
// if the function argument is given to overlay,
// it is assumed to be the onBeforeLoad event listener
$("a[rel]").overlay({
mask: 'darkred',
effect: 'apple',
onBeforeLoad: function() {
// grab wrapper element inside content
var wrap = this.getOverlay().find(".contentWrap");
// load the page specified in the trigger
wrap.load(this.getTrigger().attr("href"));
}
});
});
</script>