I have a bit of a puzzle on my hands.
I have 2 $.each blocks that get data from a JSON file, but I need them to one after another instead of one block first and then the next one. I know it is in my logic, but I can't seem to crack this one :-(
//block 1
if (entry.hasOwnProperty('class2'))
{
$.each(entry.class2, function (index, data)
{
test01 = this.name;
});
}
//block 2
if (entry.hasOwnProperty('tutors'))
{
$.each(tutors, function (index, data)
{
test02 = this.fname;
});
}
So these both have multiple entries and what it is doing at the moment is:
block 1, block 1, block1, block 2, block 2, block 2 // according to the amount of entries.
What i need is:
block 1, block 2, block 1, block 2, block 1, block 2 // according to the amount of entries.
I have tried using functions, but no success there, but this logic is inside another $.each
block and yes they have to be inside that $.each
block.