基本上,我试图在触发isset($ _ POST [“submit”])时强制打开我的一个Jquery移动弹出窗口。
请注意,在这种情况下,在页面加载时弹出窗口加载不起作用,必须在提交表单时激活它。
例如:
<?php
if(isset($_POST['submit']))
{
//other stuff
//force open popup
}
?>
<form method='post' action='self.php'>
<input type='submit' name='submit' value='submit' />
</form>
<a href="#popup" data-rel="popup" data-position-to="window" data-role="button" data-inline="true" data-icon="check" data-theme="a" data-transition="pop">popup</a>
<div data-role="popup" id="popupLogin" data-theme="a" class="ui-corner-all">
<!-- Popup contents -->
</div>
先谢谢!
答案 0 :(得分:3)
你能尝试一下吗?
<script type="text/javascript">
$('#form').on('submit', function () {
$("#popupLogin").popup("open")
});
</script>
奥马尔的信誉 谢谢你纠正我:)
答案 1 :(得分:1)
你能不能回复一些东西让弹出窗口显示出来,或者如果它是正常打开它的a
你可以模拟它的点击......
<?php
if(isset($_POST['submit']))
{
//other stuff
?>
<script type="text/javascript">
$("document").ready(function(){
// Simulate a click on a. I'd recommend giving A an ID or class to get it.
$("a[href=#popup]").click();
});
</script>
<?php
}
?>
答案 2 :(得分:1)
Add id to anchor tag and use its click event when posted. Code below:
<form method='post' action='self.php'>
<input type='submit' name='submit' value='submit' />
</form>
<a id="popUp" href="#popup" data-rel="popup" data-position-to="window" data-role="button" data-inline="true" data-icon="check" data-theme="a"
<div data-role="popup" id="popupLogin" data-theme="a" class="ui-corner-all">
<!-- Popup contents -->
</div>
<?php
if(isset($_POST['submit']))
{
//other stuff
//force open popup
echo "<script>";
echo "$('#popUp').click();"
echo "</script>";
}
?>