Support » Plugin: Ajax Search Lite » Populate search field and display results – Ajax

  • Hi there

    I would like to create a link that populate the search field and run the search, displaying results.

    For clarification: I will create a link saying view other posts containing xxxxx

    and would than want to populate the search box with xxxxx and show the results via Ajax once the link has been clicked.

    Any help on this would be greatly appreciated.

    Kind Regards
    Brad

Viewing 1 replies (of 1 total)
  • Plugin Author wpdreams

    (@wpdreams)

    Hi,

    Well, you need some scripting for that. Basically you can trigger the search process by triggering the “input” event on the input field:

    jQuery('input.orig').val('phrase').trigger('input')

    If you have an anchor, with the class name “my-class”, then the click event with the trigger would look something like this:

    jQuery('a.my-class').on('click', function(e){
        e.preventDefault();
        jQuery('input.orig').val(jQuery(this).text()).trigger('input');
    });

    Best,
    Ernest M.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.