Last active
July 9, 2018 21:23
-
-
Save timersys/3316397ada0c43d1ec5623b5f09c17a6 to your computer and use it in GitHub Desktop.
Open popup after Gravity form submission - More on https://timersys.com/how-to-display-a-popup-after-user-submits-form/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // don't add this tag | |
// Print javascript code in the footer of the site to trigger the popup upon form submission | |
add_action('wp_footer', 'add_popups_trigger_code',150 ); | |
function add_popups_trigger_code(){ | |
// show code on certain page, comment out to print code on every page | |
if( ! is_page(520) ) | |
return; | |
?> | |
<script> | |
jQuery(document).ready(function(){ | |
jQuery(document).bind('gform_confirmation_loaded', function(event, formId){ | |
if(formId == 1) { | |
// run code specific to form ID 1 and popup 123 | |
SPU.show('529'); | |
} else if(formId == 2) { | |
// run code specific to form ID 2 | |
SPU.show('529'); | |
} | |
}); | |
}) | |
</script> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment