I have an Html.Textbox that I allow the user to type a customer name into. Once they reach 3 or more characters I call an autocomplete function which returns a list of customers in a dropdown. When they make a selection I would like to make another ajax call which would return a new view. My problem is when I add the second call the data from the autocomplete is removed. This is what I have so far:
$("#CustomerSearch_FullName").autocomplete({ minLength: 3, fontSize: '10px', source: function (request, response) { $.ajax({ url: '@Url.Action("CustomerNameAutoComplete", "Customer")', async: false, data: { searchstring: $.trim(request.term) }, success: function (data) { response($.map(data, function (item) { $('#CustomerIdDisplay').val(item.id); $('#customer-select').val(item.id); $('#Order_Customer_FirstName').val(item.firstname); $('#Order_Customer_Email').val(item.email); return { label: item.choice, id: item.id }; })); }, }); }, select: function (event, ui) { id = ui.item.id; $.ajax ({ url: '@Url.Action("Create", "Order")', data: { customerId: id } });