Skip to content

Instantly share code, notes, and snippets.

@faisalahammad
Last active August 31, 2025 03:32
Show Gist options
  • Save faisalahammad/4c8a20d068d4a7844a7924dbe820090a to your computer and use it in GitHub Desktop.
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
/**
* 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;
}
});
}
});
@faisalahammad
Copy link
Author

Preview:

CleanShot 2025-08-31 at 08 59 26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment