The ".result" event will trigger when an option is selected

so

$("#suggestion").autocomplete(
    ...  your existing code
}).result(a, data, c) {
    // Variable "data" has the option the user selected
    // Make your call here
});



On Mar 9, 11:21 am, visionmaster <tar...@web.de> wrote:
> Hello together,
>
> I'm using the Autocomplete jQuery plugin from bassistance, 
> seehttp://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/
>
> It actually works fine. When I click on an element from the
> autosuggest-list, it's value is correctly transfered to the associated
> input field.
>
> Now I want to enhance the functionality as the following. When I click
> an element from the autosuggest-list, I want to trigger a PHP script,
> which does a search over the passed value right away.
>
> I unfortunately have no idea how to do that. Anyone have an idea?
>
> Here my code:
>
> <script src="../../include/jquery/jquery.js" type="text/javascript"></
> script> <link rel="stylesheet" href="../../include/jquery/autocomplete/
> jquery.autocomplete.css" type="text/css" /> <script type="text/
> javascript" src="../../include/jquery/autocomplete/
> jquery.autocomplete.js"></script>
>
> <script>
>         $(document).ready(function() {
>
>                         function selectItem(li) {
>
>                                         return false;
>
>                         }
>
>                         function formatItem(row) {
>
>                                         return row[0] + " <i>(" + row[1] + " 
> Geräte)</i>";
>
>                         }
>
>                         $("#suggestion").autocomplete("../../include/
> suggest_quicksearch.php", {
>                                 delay:10,
>                                 minChars:3,
>                                 matchSubset:1,
>                                 matchContains:1,
>                                 width:250,
>                                 selectFirst:false,
>                                 onItemSelect:selectItem,
>                                 formatItem:formatItem,
>                                 cacheLength:10
>                         });
>         });
>
> </script>
>
> Thanks for your help.

Reply via email to