【发布时间】:2021-12-09 14:59:07
【问题描述】:
我有 API 的数据结果:
"tabledata": [
{
"itemname": {
"class": "level1 levelodd oddd1 b1b b1t column-itemname",
"colspan": 7,
"content": "<i class=\"icon fa fa-folder fa-fw icon itemicon\" title=\"Category\" aria-label=\"Category\"></i>Intro to Computing IT1016",
"celltype": "th",
"id": "cat_2_23"
},
},
{
"itemname": {
"class": "level2 leveleven item b1b column-itemname",
"colspan": 1,
"content": "<a title=\"Link to Quiz activity Exercise 2.1\" class=\"gradeitemheader\" ><img class=\"icon itemicon\" alt=\"Quiz\" />Exercise 2.1</a>",
"celltype": "th",
"id": "row_94_23"
},
"grade": {
"class": "level2 leveleven item b1b itemcenter column-grade",
"content": "10.00",
"headers": "cat_2_23 row_94_23 grade"
},
},
]
我可以得到 itemname.content 但grade.content 不能。
如何编码获取grade.content 和子字符串itemname.content?
我编写 javascript 代码并做出反应
【问题讨论】:
-
您能否更新您的问题,向我们展示您正在使用的代码在做什么?如果我们看不到代码在做什么,我们真的无能为力。 stackoverflow.com/help/minimal-reproducible-example
-
如果你能得到
itemname.content你应该可以用同样的方法得到grade.content。
标签: javascript reactjs json api