4
다음 JSON 데이터가 클라이언트로 전송됩니다. 어떻게 든 데이터를 추출해야 루프를 통해 모든 값을 얻을 수 있습니다. & 카운트 값. jQuery을 활용클라이언트 측에서 Json 데이터 추출
{
"summarydata": {
"rows": [
{
"name": "Cisco0 Webinar US",
"count": "1"
},
{
"name": "Resource Nation CC",
"count": "1"
},
{
"name": "test",
"count": "10"
},
{
"name": "test",
"count": "2"
},
{
"name": "Vendor Seek",
"count": "1"
}
]
}
}
$.extend($.jgrid.defaults,
{ datatype: 'jsonstring' },
{ ajaxGridOptions: { contentType: "application/json",
success: function (data, textStatus) {
if (textStatus == "success") {
var thegrid = $("#BuyBackGrid")[0];
thegrid.addJSONData(data.data);
var summaryresult = $.parseJSON(data.summarydata.rows[0]);
alert(summaryresult);// this gives me null
alert(data.summarydata.rows[0].name); //this gives me first name element which is "Cisco0 Webinar US" in my case.
// alert($.parseJSON(data).summarydata.rows[0].name);
}
} //end of success
}//end of ajaxGridOptions
});
어떤 언어 ?? –
JSON 라이브러리에서 라이브러리를 사용하고 있습니까? – bensiu
나는 ajax 호출을 만들고 JSON 데이터를 클라이언트에 반환하기 위해 asp.net 처리기를 사용하고있다. 응답. 추가 ("summarydata", summarytoken); – user659469