使用JSON数组的jQuery 'each'循环
- 论坛
- 使用JSON数组的jQuery 'each'循环
28 浏览
使用JSON数组的jQuery 'each'循环
我正在尝试使用jQuery的each
循环来遍历这个JSON,并将其添加到名为#contentHere
的div
中。JSON如下:
{ "justIn": [
{ "textId": "123", "text": "你好", "textType": "问候" },
{ "textId": "514", "text":"最近怎样?", "textType": "问题" },
{ "textId": "122", "text":"过来这边", "textType": "命令" }
],
"recent": [
{ "textId": "1255", "text": "你好", "textType": "问候" },
{ "textId": "6564", "text":"最近怎样?", "textType": "问题" },
{ "textId": "0192", "text":"过来这边", "textType": "命令" }
],
"old": [
{ "textId": "5213", "text": "你好", "textType": "问候" },
{ "textId": "9758", "text":"最近怎样?", "textType": "问题" },
{ "textId": "7655", "text":"过来这边", "textType": "命令" }
]
}
我通过以下代码获取这个JSON:
$.get("data.php", function(data){ })
有什么解决方案吗?