Автозаполнение с несколькими входами ядра asp.netJquery

Программирование на jquery
Гость
Автозаполнение с несколькими входами ядра asp.net

Сообщение Гость »


person! I really need help, I'm trying to do an Autocomplete with multiple inputs in ASP.NET Core, but at the moment I'm only able to return one value. When I enter the person's name I can bind the city, I would like to bind email, department

Код: Выделить всё

    [HttpPost]     public JsonResult AutoCompletePeoples(string prefix)     {         var pessoas = (from pessoa in _context.Pessoas                           where pessoa.NamePeople.StartsWith(prefix)                           select new                           {                               label = pessoa.NamePeople,                               val = pessoa.City                           }).ToList();         return Json(pessoas);     }       $(function () {         $("#txtNomeVisitante").autocomplete({             source: function (request, response) {                 $.ajax({                     url: '/Visitas/AutoCompletePeoples/',                     data: { "prefix": request.term },                     type: "POST",                     success: function (data) {                         response($.map(data, function (item) {                             return item;                         }))                     },                     error: function (response) {                         alert(response.responseText);                     },                     failure: function (response) {                         alert(response.responseText);                     }                 });             },             select: function (e, i) {                 $("#txtCity").val(i.item.val);             },             minLength: 1         });     });  


Источник: https://stackoverflow.com/questions/781 ... p-net-core

Вернуться в «Jquery»