I have a jQuery autoplay window displaying the correct data. Now I would like to start the ASP.NET MVC 3 controller when an item is selected. Then the controller should redirect to the view. Here's my jQuery autocompletion code (I'm sure something is missing in the second Ajax call, but I haven't found it yet):
<script type="text/javascript"> $(function () { $("#Client").autocomplete({ source: function (request, response) { $.ajax({ url: 'Entity/GetClientAutoComplete', type: 'POST', dataType: 'json', data: { query: request.term }, success: function (data) { response($.map(data, function (item) { return { label: item, value: item }; })) } }) }, minLength: 1, select: function (event, ui) { $.ajax({ url: 'Entity/GetApplicationsByName/' + ui.item.value, type: 'POST' }) } }); }); </script>
And here is the controller I'm trying to call:
public ActionResult GetApplicationsByName(string id) { ViewBag.Client = id; var apps = _service.GetDashboardByName(id); return View("Dashboard", apps.ToList()); }
When I watch Ajax fire in Firebug, I see the correct URL configuration, but nothing else happens. He acts as if he wants to download something, not send something. I'm confused. Thanks for any recommendations.
source share