title: MVC with Autocomplete Not working
body: <p>I have this code that does the auto complete but apparently I am doing something wrong as it not working.</p>
  
  <p>This is my view:</p>
  
  <pre><code>@Html.EditorFor(model =&gt; model.city)&lt;br /&gt;
  @Html.ValidationMessageFor(model =&gt; model.city)
  
  &lt;script src='http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js' type="text/javascript"&gt;&lt;/script&gt;
  &lt;script src='&lt;%: Url.Content("~/Scripts/jQueryUI/jquery-ui-1.8.2.custom.min.js") %&gt;'
      type="text/javascript"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;    
      $("#city").autocomplete({
          source: '&lt;%: Url.Action("Location", "CityList") %&gt;'
      });        
  &lt;/script&gt;
  </code></pre>
  
  <p>This is my controller:</p>
  
  <pre><code>public class LocationController : Controller
  {
      private pEntities db = new pEntities();
  
      public ActionResult CityList(string city)
      {
          var results = from c in db.CityCodes
                        where c.city.StartsWith(city)
                        select new { label = c.city, id = c.city_id };
          return Json(results.ToArray(), JsonRequestBehavior.AllowGet);
      }
  </code></pre>