Skip to content

Instantly share code, notes, and snippets.

@venblee
Created June 23, 2013 05:55
Show Gist options
  • Save venblee/5843969 to your computer and use it in GitHub Desktop.
Save venblee/5843969 to your computer and use it in GitHub Desktop.
Returing Json from MVC Conntroller
public JsonResult SearchCity(string searchTerm)
{
var city = _locationService.SearchCity(searchTerm);
var result = city.Select(a => new { id = a.Id, text = a.City });
return Json(result, JsonRequestBehavior.AllowGet);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment