Hey, I'm looking to handle an XML response depending on what's sent. Better than I can explain it, here's an example...
- function stateChanged () {
-
if (xmlHttp.readyState == 4) {
-
var xmlDoc = xmlHttp.responseXML;
-
-
if (xmlDoc.getElementsByTagName("error")) {
-
alert('error');
-
}
-
}
-
}
Alright, the response will be either all in <a></a> or <b></b> tags, but if there is an error, it will return <error></error> with all of the errors inside. I'd like to set up an if/else that will detect if the response is <error></error> or if it's actually something I'm going to use.
I don't know how to differentiate the two though. What I have there in the if/else seems to always return true. Has anyone else had this problem or knows the solution? Thanks!