trigger javascript from jquery autocomplete

Lets assume I have a javascript method called createrow(dt, table)

I would like to call that when a user selects an item in my jquery autocomplete.

Ultimately what I need to do  is actually create a row in my jquery datatable when this happens..but I will make this function call do that  ....

Can someone help me with wiring this up..assuming the  method createrow(dt,table)

Here is my autocomplete code in my view in the scrips section

 $(".caAutoComplete_EntityEntityNameSearch").autocomplete(
        {
            source: "@Url.Content("~/Shared.mvc/EntityEntityNameSearchAuto")",
            minLength: 3,
            select: function (event, ui) {
                var inputlabel = ui.item.label;
                var inputvalue = ui.item.value;
                $("#hdnClientId").val(inputlabel);

             return false;
            }
        });

Open in new window


Here is where I use it in html:

<div id="main-container" class="container-fluid">
    <div class="col-xs-12">
        <div class="row" style="margin-bottom:4px;">
            <div class="col-md-1">
                <span style="font-size:11pt;font-weight:bold;">Entity Name:</span>
            </div>
            <div class="col-md-2">
                @Html.TextBoxFor(x => x.SearchEntityNameOrId, new { @type = "text", @placeholder = "Search", @class = "caAutoComplete_EntityEntityNameSearch", @style = "width:100%!important;" })
            </div>

        </div>
    </div>

Open in new window

LVL 11
Robb HillSenior .Net DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

leakim971PluritechnicianCommented:
you may do this call inside your select function or response one
http://api.jqueryui.com/autocomplete/#event-response
http://api.jqueryui.com/autocomplete/#event-select

select: function (event, ui) {
    // put you call here

Open in new window

or :
response: function (event, ui) {
    // put you call here

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.