Json Object List.
-------------------------
var params = new Object();
params.Id = personId;
params.cls = Class;
$.ajax({
type: "POST",
dataType: "json",
data: $.toJSON(params),
contentType: "application/json",
url: "../OtpWebService.asmx/GetStudentDetails",
alert(response.d);
}
});
The out-put, when i do alert(response.d); is given below.
actually this is an json object returned by a above code from c#.
[
{"Name":"Nthal","Class":3,"SubjectName":"English "},
{"Name":"Mishal","Class":4,"SubjectName":"Grammer"},
{"Name":"Sanjeev","Class":3,"SubjectName":"Social"},
{"Name":"Michal","Class":5,"SubjectName":"Gk"},
]
如果我尝试警报(响应);结果将只是 --> [object] [object]。如何遍历此对象列表中的每个元素并通过 document.write.. 打印?