Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › trigger the search on passing in a value › Reply To: trigger the search on passing in a value
February 22, 2017 at 10:12 am
#12068
Hi,
If I’m not mistaken, you are using this code currently:
jQuery( document ).ready(function($) {
$('.cat-head').on('click', function(e){
e.preventDefault();
var srch = $(this).find('.cat-head-element').html();
$('.orig').val(srch);
});
});
It’s almost perfect, but the best way of triggering the search, is to use the search javascript API, instead of changing the node values. This should be the best possible solution:
jQuery( document ).ready(function($) {
$('.cat-head').on('click', function(e){
e.preventDefault();
var srch = $(this).find('.cat-head-element').html();
ASP.api(0, 'searchFor', srch);
});
});
To learn more about API functions, you can check this documentation article.
Best,Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)