Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › form action to external website (no ajax results needed) › Reply To: form action to external website (no ajax results needed)
February 16, 2022 at 3:53 pm
#36763
Keymaster
Maybe that one will not work, I can’t recall if the javascript does validate agains the current domain. Maybe instead of the previous code, try this one:
add_action('wp_footer', 'asp_add_footer_script', 9999);
function asp_add_footer_script() {
?>
<script>
(function($){
WPD.Hooks.addFilter('asp_redirect_url', function(url, id, instance){
return "https://externalwebsite.com/search?q=" + $('.asp_m_' + id + '_' + instance).find('input.orig').val();
}, 10);
}(WPD.dom));
</script>
<?php
}
It is a bit more complicated, but it changes the URL right before the submission, so it should be more likely to work.