forum

Home / DeveloperSection / Forums / AutoComplete Controller Action not being called

AutoComplete Controller Action not being called

Anonymous User 1860 27-Nov-2014

I have a editbox which is linked to auto-complete handler, when I type any character the controller method itself not calling and its not even working also. 

jQuery 

$("#NameInput").autocomplete({
    minChars: 3,
    delay: 100,
    cacheLength: 25,
    autoFill: true,
    source: function (request, response) {
        $.ajax({
            url: "/Data/GetNames", dataType: "json",
            data: { id: request.term },
            success: function (data) {
                response($.map(data, function (item) {
                    return { label: item.label, value: item.id }; //updated code
                }));
            }
        });
    },
    select: function (event, ui) {
        return false;
    }
});

Here is the controller method. 

C# 

[RequiresRole(Roles = "su, da, rv, sp, dg, ap, ua")]
[AcceptVerbs(HttpVerbs.Get)]
public string GetNames(string term )
{
    //perform DB operations
    return String.Empty;
}

ASPX 

<input type="text" name="NameInput" id="NameInput" class="NameInputField" maxlength="80" tabindex="3" />

Here getNames method itself not calling, at the time of launching I'm just registering for auto-complete handler. What will be the issue?


Updated on 28-Nov-2014
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By