Skip to content
Advertisement

How do you force a Jquery Mobile popup to open using php?

Basically, I am trying to force one of my Jquery mobile popups to open up when isset($_POST["submit"]) is triggered.

Note that having the popup load on page load will not work in this situation, it must be activated when the form is submitted.

For example:

<?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>

Advertisement

Answer

Can you try this one ??

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

Credits to Omar thanks for correcting me 🙂

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement