This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: form action to external website (no ajax results needed)

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)

#36763
Ernest MarcinkoErnest Marcinko
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.