Everything look fine beside the model, it look a little odd. I think that code will throw circular reference error. Try move the model population code outside the locations class. Here is an example.
Model
public class Locations
{
public int Id { get; set; }
public string Name { get; set; }
}
Controller
public class DefaultController : Controller
{
public JsonResult Search(string term)
{
List<Locations> l = new List<Locations>()
{
new Locations() {Id = 1, Name = "London"},
new Locations() {Id = 2, Name = "Walles"},
new Locations() {Id = 3, Name = "Birmingham"},
new Locations() {Id = 4, Name = "Edinburgh"},
new Locations() {Id = 5, Name = "Glasgow"},
new Locations() {Id = 6, Name = "Liverpool"},
new Locations() {Id = 7, Name = "Bristol"},
new Locations() {Id = 8, Name = "Manchester"},
new Locations() {Id = 9, Name = "NewCastle"},
new Locations() {Id = 10, Name = "Leeds"},
new Locations() {Id = 11, Name = "Sheffield"},
new Locations() {Id = 12, Name = "Nottingham"},
new Locations() {Id = 13, Name = "Cardif"},
new Locations() {Id = 14, Name = "Cambridge"},
new Locations() {Id = 15, Name = "Bradford"},
new Locations() {Id = 16, Name = "Kingston Upon Hall"},
new Locations() {Id = 17, Name = "Norwich"},
new Locations() {Id = 18, Name = "Conventory"}
};
List<string> Loc;
Loc = l.Where(x => x.Name.StartsWith(term)).Select(x => x.Name).Distinct().ToList();
return Json(Loc, JsonRequestBehavior.AllowGet);
}
public ActionResult Index()
{
return View();
}
}