I am totally stuck, I am sure the problem is small but I can't get my mind around it. I can't find a way to display the content that I get from the Array correctly. I have searched SO but couldn't find any correct answers.
Here is the JSON:
{
"rooster": {
"weekdag": {
"1": {
"uur": {
"1": {
"teacher": "EVDIS",
"subject": "ENG",
"room": "312"
},
To explain it a little further, weekdag contains 5 Objects that represent the day of the week. Within that is an Object called uur. It represents an hour. Each day contains 10.
The code that is currently used to display all of the data:
$.ajax({
type: "GET",
dataType: "json",
url: '/c00012.json',
success: function (data) {
//Sort of displays the schedule
$.each(data.rooster.weekdag[1].uur, function() {
$.each(this, function(name, value) {
document.write(value);
});
});
}
});
It displays this:
ENGEVDIS312ENGEVDIS312SDEMONK308SDEMONK308
So, what I want to achieve is to print it out like this:
Hour 1: Teacher: EVDIS
Subject: ENG
Room: 312
Hour 2: Teacher: EVDIS
Subject: ENG
Room: 312
I might have explained it a bit weird, if any other information is needed let me know.