[jQuery] looping through json

2009-03-26 Thread iceangel89
how can i loop through json like: { "departments": { "department": {"ID": 1, "Name": "Physics"}, "department": {"ID": 2, "Name": "Chemistry"}, "department": {"ID": 3, "Name": "Biology"} }} i tried $.each(json.departments.department, function(i, n) { alert(i + " " + n); }); and

[jQuery] looping through json and adding dom elements (options)

2009-03-25 Thread iceangel89
i am new to jquery and what i intend to do now is to load json from server and then based on the json, remove all options from a drop down and populate it with new items from the json. something like a cascading drop down. i dunno if the json outputted is correct? do i need something like "depart