Last active
August 31, 2025 03:32
-
-
Save faisalahammad/4c8a20d068d4a7844a7924dbe820090a to your computer and use it in GitHub Desktop.
Open Ninja Forms redirect URL in a new tab — PHP code snippet to open the redirect URL in a new tab after form submission
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
| /** | |
| * Open Ninja Forms redirect URL in a new browser tab after form submission. | |
| * @author Faisal Ahammad <[email protected]> | |
| */ | |
| jQuery(document).ready(function($) { | |
| if (typeof nfRadio !== 'undefined') { | |
| nfRadio.channel('forms').on('submit:response', function(response, textStatus, jqXHR, formId) { | |
| if (response && response.data && response.data.actions && response.data.actions.redirect && response.data.actions.redirect !== '') { | |
| var redirectUrl = response.data.actions.redirect; | |
| delete response.data.actions.redirect; | |
| // Open redirect in a new tab | |
| window.open(redirectUrl, '_blank'); | |
| return false; | |
| } | |
| }); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Preview: