如何在从AJAX 响应返回的JSON
in之后进行迭代。JavaScript
PHP
[{
"Topic": {
"id": "1",
"topic_name": "Playground"
}
}, {
"Topic": {
"id": "2",
"topic_name": "School Days"
}
}, {
"Topic": {
"id": "3",
"topic_name": "Sweet home"
}
}]
我正在尝试类似但不工作的东西
for (i in xmlhttp.responseText)
{
document.getElementById('wrap_main').innerHTML+=xmlhttp.responseText[i]['topic'].name + "<br />";
}