I have some forms using the plugin contact form 7 and each one redirecting to a specific success page, I used on_sent_ok, however he does not want to run I went to check and found out that it is obsolete and the correct one now is to use the gift, but nothing happens when trying to put the gift.
I'm trying to use the following code, include it in functions.php:
add_action( 'wp_footer', 'mycustom_wp_footer' );
function mycustom_wp_footer() {
?>
<script>
document.addEventListener( 'wpcf7submit', function( event ) {
if ( '238' == event.detail.contactFormId ) {
location = 'http://www.site.com.br/sucesso1';
}else if ( '235' == event.detail.contactFormId ) {
location = 'http://www.site.com.br/sucesso2';
}
}, false );
</script>
<?php
}