Advertisement
LrdArc

jqform

Jun 23rd, 2016
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.40 KB | None | 0 0
  1. <?php
  2. if ( $_POST['bla'] ) {
  3.     // do things
  4. }
  5. ?>
  6. <form id="jqform" action="bla.php" method="post">
  7.     <input type="text" name="bla">
  8.     <button type="submit">Submit!</button>
  9. </form>
  10.  
  11. <script>
  12.     $( '#jqform' ).submit( function() {
  13.         var actions = $( '#jqform' ).attr( 'action' );
  14.         $.post( actions, $( '#jqform' ).serialize(), function( data ) {
  15.             // results here
  16.         });
  17.         return false;
  18.     });
  19. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement