1

基本上,我试图在 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>

提前致谢!

4

3 回答 3

3

你可以试试这个吗??

<script type="text/javascript">
 $('#form').on('submit', function () {
    $("#popupLogin").popup("open")
  });
</script>

感谢 Omar 对我的纠正:)

于 2013-10-07T08:21:05.487 回答
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
}
?>
于 2013-10-07T08:21:56.443 回答
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>";
    }
    ?>
于 2013-10-07T08:23:13.717 回答