Imtiaz Abbas Imtiaz Abbas - 1 year ago 71
Javascript Question

Unable to get exact data from XML into JavaScript

I am just trying to alert the email from the XML but I am getting this as an alert.

▛▛ ▛

Help me in removing these box symbols. I actually wanted to validate the email, but I couldn't do that because the value returned contains these symbols.


function process(){
if(xmlhttp.readyState == 4 || xmlhttp.readyState == 0){"GET", "../text/info.xml", true);
xmlhttp.onreadystatechange = responseServer;
} else {
setTimeout("process()", 1500);

function responseServer(){
if(xmlhttp.readyState==4 && xmlhttp.status==200){
docxml = xmlhttp.responseXML;
emails = docxml.getElementsByTagName('email');

Answer Source


alert( emails[0].firstChild.nodeValue );


alert( emails[0].firstChild.textContent );
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download