I spent a lot of time studying this and just don’t see what happened. I have the following:
$.getJSON(
'/adminStatus/GetJsonData',
{ name: $('#textSearch')[0].value },
function (data) {
alert("3");
// $('#studentList > div').remove();
// for (s in data) {
// alert("4");
// var student = data[s];
// $('#studentList').append('<div>(' + student.StudentId + ') ' + student.FirstName + ' ' + student.LastName + '</div>');
// }
}
);
This code runs an action in my controller, and this action returns data. This is actually code from another example:
public JsonResult GetJsonData(string name)
{
return new JsonResult
{
Data = (from student in Student.GetStudentDataList()
where student.LastName.StartsWith(name)
select student).ToArray<Student>()
};
}
I check and the data is populated with data.
However, nothing happens with the returned data, and when I added comments, I can not even get a warning ("3").
Am I doing something really clearly wrong? I think I am copying a working example, but nothing is returned, and the function (data) {} does not seem to be executed.
Any help would be greatly appreciated.
Thank,
source
share