使用jquery访问c#对象列表

时间:2014-08-26 21:29:12

标签: javascript jquery json

我无法弄清楚为什么我无法访问结果元素。

什么回来了:

[{"customSurfaceMaster":   {"CSMasterID":1,"CSName":"Q17","QuestionId":12,"OpType":"22","OpFlag":null,"ChartType":"Bar"},"UserCSID":1,"UserId":2,"CSMasterID":1,"PeriodType":null,"PeriodStartValue":null,"PeriodEndValue":null,"ImpLevel":1,"DisplayOrder":1,"Visible":true}]

尝试访问此处:

var Tile = BindTiles(result.customSurfaceMaster.chartType, result.customSurfaceMaster.CSname, result.ImpLevel);

错误:

 result.customSurfaceMaster is undefined

1 个答案:

答案 0 :(得分:0)

试试这个:

var Tile = BindTiles(result.customSurfaceMaster[0].chartType, result.customSurfaceMaster[0].CSname, result.ImpLevel);