I need to get a list from mvc controller to view using jquery ajax. how can i do that. this is my code. Its alerting error message.
publ
1-Create One model To NameOf User
public class User
{
public int Id { get; set; }
public string Name { get; set; }
public string Family { get; set; }
}
2-Create one ActionResult To NameOf GetUsers
public ActionResult GetUsers()
{
List users = new List()
{
new Models.User(){Id=1,Name="Diako",Family="Hasani"},
new Models.User(){Id=2,Name="Sina",Family="Moradi"},
new Models.User(){Id=3,Name="Hamid",Family="Chopani"}
};
return Json(users,JsonRequestBehavior.AllowGet);
}
3-To Your View Create One div
4-write this code to script