Hi,
I'm trying to learn JavaScript. I'm missing something that has to do w/ reading stuff from (what I hope is) a JSON data structure.
This function:
Does not give any errors, but it also does not yield what I expect.
Here's the data:
Would appreciate if someone can tell me why I can't access the data, esp. the "abbr" field. (I realize my code doesn't reflect that, but the idea is that want to retrieve *all* the data.
Thanks!
I'm trying to learn JavaScript. I'm missing something that has to do w/ reading stuff from (what I hope is) a JSON data structure.
This function:
Code:
function myFunction(){
outputter = document.getElementById("outputter");
outputter.innerHTML = "";
for (var z in Township) {
outputter.innerHTML += " Z = " + z + " " + "<br>";
for (var w in Township[z]) {
outputter.innerHTML += " w = " + w + " =" + Township.z
} } }
Here's the data:
Code:
var Township = {
'Boon Lake' : [
{'abbr' : 'BLK', 'SId' : 16, 'lat' : 44.35176, 'long' : -93.19764 },
{'abbr' : 'BLK', 'SId' : 17, 'lat' : 44.35276, 'long' : -93.18764 }
],
'Sacred Heart' :[
{'abbr' : 'BLK', 'SId' : 16, 'lat' : 44.35176, 'long' : -93.19764 },
{'abbr' : 'BLK', 'SId' : 17, 'lat' : 44.35276, 'long' : -93.18764 }
]
};
Thanks!
Comment