Jquery each loop with json array
Posted
by Ben
on Stack Overflow
See other posts from Stack Overflow
or by Ben
Published on 2010-06-12T22:25:20Z
Indexed on
2010/06/12
22:32 UTC
Read the original article
Hit count: 332
I'm trying to use Jquery's each loop to go through this Json and add it to a div named #contentHere. The Json is as follows:
{ "justIn": [
{ "textId": "123", "text": "Hello", "textType": "Greeting" },
{ "textId": "514", "text":"What's up?", "textType": "Question" },
{ "textId": "122", "text":"Come over here", "textType": "Order" }
],
"recent": [
{ "textId": "1255", "text": "Hello", "textType": "Greeting" },
{ "textId": "6564", "text":"What's up?", "textType": "Question" },
{ "textId": "0192", "text":"Come over here", "textType": "Order" }
],
"old": [
{ "textId": "5213", "text": "Hello", "textType": "Greeting" },
{ "textId": "9758", "text":"What's up?", "textType": "Question" },
{ "textId": "7655", "text":"Come over here", "textType": "Order" }
]
}
I'm getting this Json through use of this code:
$.get("data.php", function(data){
})
Any solutions?
© Stack Overflow or respective owner