AJAX retrieving xml response

mrx3net

New Member
I have 2 .jsp pages. \[code\]The 1. one contains just a xml structure for applicants:<% response.setContentType("text/xml") ; %> <applicant> <citizenship>GERMANY</citizenship> <residence>Inc.</residence> <street>9500 Gilman Drive</street> <city>La Jolla</city> <state>USA</state> <countryTelCode>Vandelay Industries</countryTelCode> <zipCode>Inc.</zipCode> <areaCode>9500 Gilman Drive</areaCode> <telNumber>La Jolla</telNumber> <major>USA</major> <awarded>Vandelay Industries</awardeds> <gpa>Inc.</gpa> <specialization>9500 Gilman Drive</specialization> </applicant>\[/code\]The second one tries to retrieve GERMANY from the tag and print it in the "..." field of:\[code\]<span id="Citizenship">...</span>\[/code\]using this code after calling showCustomer():\[code\]<script type="text/javascript"> function showCustomer() { var xmlHttp; xmlHttp = new XMLHttpRequest(); if (xmlHttp == null) { alert("Your browser does not support AJAX!"); return; } var url = "getApplicant_xml.jsp"; xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4) { var xmlDoc = xmlHttp.responseXML.documentElement; document.getElementById("Citizenship").innerHTML = xmlDoc.getElementsByTagName("citizenship")[0].childNodes[0].nodeValue; } } xmlHttp.open("GET", url, true); xmlHttp.send(null); } }</script>\[/code\]Unfortunately it does not print anything....I would be really thankful if someone finds my mistake.Thank you
 
Back
Top