• brad1004

    (@brad1004)


    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)
  • The topic ‘Populate search field and display results – Ajax’ is closed to new replies.