Code: Show/Hide function processReqChange() {
// only if req shows "loaded" if (http.readyState == 4) { if (http.status == 200) { document.submitLink.categories.disabled = false; alert("We're good to go..."); var XMLResponse = http.responseXML; var product_list = XMLResponse.getElementsByTagName("list"); var product_id = XMLResponse.getElementsByTagName("category"); alert("SIZE: " + product_list.length + "x" + product_id.length); // returns: SIZE: 1 x 3 var select = document.submitLink.categories; //clearTopicList(select); for (var i = 0; i < product_id.length; i++) { alert("i = " + i + " " + product_id[i].getAttribute('id') + " " + product_id[i].getAttributeNode('name')); } alert('DONE.'); } else { alert("There was a problem retrieving the XML data:\n" + http.statusText); } } } |
Code: Show/Hide <list>
<category id="1"> <name>History</name> </category> <category id="2"> <name>Art</name> </category> <category id="3"> <name>CSC</name> </category> </list> |
Code: Show/Hide product_id[i].getAttribute('id').childNodes.item(0) |