title: asp.net mvc4 jquery ui autocomplete not working
body: <p>I want to use autocomplete widget in asp.net mvc4 app. I was able to call the action to get list of autcompletition values from controller. Unfortunetely I am not able to add it to list of suggestions. I think that .map(data, function(item) in success part of autocomplete ajax call is not working. But I really do not know why. I am  sure that all the scripts and css are load corectly. I am stating controller action returining suggestions list, also script in view and response from firebug. I was also trying the demo example from jqueryui page and it was working, but somehow it does not work over my returned data. Can someone help me and tell me why? Thank you in advance.</p>
  
  <p>Action in Controller:</p>
  
  <pre><code>public ActionResult GetCities(int RegionId, string Name)
  {
          var ret = db.Cities.Where(c =&gt; c.RegionId == RegionId &amp;&amp;
              c.Name.Contains(Name)).Select(a =&gt; new{ CityId = a.CityId, Name = a.Name});
          return Json(ret);
   }
  </code></pre>
  
  <p>Script in view:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  $(function() {
      $("#City").autocomplete({
          source: function(request, response) {
  
          $.ajax({
             url: "@Url.Action("GetCities")",
              dataType: "json",
              contentType: "application/json; charset=utf-8",
                method: "POST",
                data: "{'RegionId': " + $("#Region").val() + ", 'Name': '" + request.term + "'}",
  
                success: function (data) {
                    response( $.map( data, function( item ) {
                        return {
  
                            label: item.Name,
                            value: item.Name
                        }
                    }));
                },
  
                error: function(XMLHttpRequest, textStatus, errorThrown) {
                    alert(textStatus);
                }
            });
  },
          minLength: 2
      });
  });
  </code></pre>
  
  <p></p>
  
  <p>Response (from firebug)</p>
  
  <pre><code>[{"CityId":16,"Name":"Kordíky"},{"CityId":94,"Name":"Korytárky"}]
  </code></pre>