The resulting simplified array works below
Following a complex array for parsing, see here .
TL; DR . You want to get each title from an array and paste it into a div, not knowing what is inside the div using jQuery - getJSON.
Change . The data comes from a piece of software that outputs a JSON string every couple of seconds with new data, so I need to output the data array to "d", as in the example below. So I have to get "Title" and "034324324" etc. For each.
Edit2 Updated code that exactly matches me.
I have a JSON array that allows me to say:
{
"Days":
["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
}
, "", div.
function getdata() {
31 $.ajaxSetup ({ cache: false});
32
33 $.getJSON(testurl, function(data) {
34 $.each(data.days, function(i,item){
35 $('#testfield').append('<p>' + item + '</p>');
36
37 });
38 });
.
Getjson , , , .
:
$('#name').html(data.Projectname);
, , , . , - , ^^.
JSON, , :
{"Projectname":"ertyofhj","Projectid":"aqwertyuqw","Projecttitle":"ertyofhj"}
, , .
.
firebug IE (Aargh)
33 $.getJSON(testurl, function(data) {
38 });
34 $.each(data.days, function(i,item){
- GET JSON. $.each, .
Firebug , JSON?
JSON - . ( ), , . - . . , ( ) , , , "+" < br/" > , . , :
{"Days":
["Sunday":"10.00", "Monday":"12.00", "Tuesday":"09.00", "Wednesday":"10.00", "Thursday":"02.00", "Friday":"05.00", "Saturday":"08.00"]
}
Dayname .