【发布时间】:2014-11-14 11:29:13
【问题描述】:
型号:
public int Id { get; set; }
public string Name { get; set; }
public string Adres { get; set; }
public string Surname { get; set; }
控制器:
[HttpGet]
public Student GetStudentById(int id)
{
var output = RepositoryFactory.Create<IStudentRepository>().GetByID(id);
return output;
}
JS:
.click(function () {
$.ajax({
type: "GET",
url: '/Admin/GetStudentById/',
data: { id: object_id },
success: function (response) {
$('#toolbox-text').val(response)
}
})
问题是我想在 3 个文本框中获取这个 item.Name、item.Adres 和 item.Surname,但是当我输入 response.Adres 时,我什么也得不到。当我输入只是响应时,我得到:文本框中的 MyNewProject.Models.Student。
【问题讨论】:
标签: jquery asp.net-mvc asp.net-ajax asp.net-mvc-5