---
title: "AutoComplete Controller Action not being called"  
description: "AutoComplete Controller Action not being called"  
author: "Anonymous User"  
published: 2014-11-27  
updated: 2014-11-28  
canonical: https://www.mindstick.com/forum/12712/autocomplete-controller-action-not-being-called  
category: "asp.net"  
tags: ["controller", "autocomplete"]  
reading_time: 2 minutes  

---

# AutoComplete Controller Action not being called

I have a editbox which is [linked](https://answers.mindstick.com/qa/104773/how-to-create-a-linked-list) to [auto](https://www.mindstick.com/forum/33810/remote-view-in-android-auto-cancel-custom-notification)-complete [handler](https://www.mindstick.com/forum/33532/handler-pagehandlerfactory-integrated-has-a-bad-module-managedpipelinehandler-in-its-module-list), when I type any [character](https://www.mindstick.com/articles/23551/an-investigate-distinctive-seafood-restaurant-for-your-image-stamp-character) the [controller method](https://www.mindstick.com/forum/157312/how-to-call-a-controller-method-after-load-view-successfully-in-mvc-4) 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?

## Replies

### Reply by Anonymous User

As far as I can see, the issue lies in your ajax call. In the data in you pass, you assign request.term to id - yet your [controller](https://www.mindstick.com/blog/273/passing-values-from-controller-to-view-in-asp-dot-net-mvc) [method](https://www.mindstick.com/forum/166/webservice-method) is looking for a parameter called term.

Change your ajax from

data: { id: request.term }

to

data: { term: request.term }

Alternatively, change your controller method from

public string GetNames(string term)

to

public string GetNames(string id)


---

Original Source: https://www.mindstick.com/forum/12712/autocomplete-controller-action-not-being-called

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
