Autocomplete select:

Autocomplete select:

Hi all,
Im using Autocomplete in my .js
i've added some properties to the source (like p which is a Class array - myClass[])
i want to be able to return this class as well as the  realValue to the modelAction (using MVC)
but the class comes empty.

please help :)

Class example  

  1. public class Service 
  2.     {
  3.         public string name { get; set; }   
  4.         public ServiceProblem[] problems { get; set; }
  5.     }
my .cshtml:

  1.  @Html.AutocompleteFor(Url.Action("AutoCompleteServiceProviders", "Create"), true, "ex. Shower", c => c.name, c => c.problems)

my .js file
  1. $(element).autocomplete({
  2.             minLength: 2,
  3.             source: function (request, response) {
  4.                 $.ajax({
  5.                     url: requestUrl,
  6.                     dataType: "json",
  7.                     data: { query: request.term },
  8.                     success: function (data) {
  9.                         response($.map(data, function (item) {
  10.                             return {
  11.                                 label: item.Label,
  12.                                 value: item.Label,
  13.                                 p: item.p,
  14.                                 realValue: item.Value
  15.                             };
  16.                         }));
  17.                     },
  18.                 });
  19.             },
  20.             select: function (event, ui) {
  21.                 var hiddenFieldName = $(this).attr('data-value-name'); // => name
  22.                 $('#'+hiddenFieldName).val(ui.item.realValue);
  23.                 $('#problems').val(ui.item.p);
  24.             }
  25.         });