The text from the file "note.xml" is applied to the paragraph with an ID of "response".
So far, so good. This XMLHttpRequest is a cool feature.
But now it falls appart. This statement doesn't seem to work:
xmlDoc is NULL.
I've tried several different XML files, taken from different sites on the web, and responseXML seems to be NULL for those also.
What am I doing wrong?
One more question.
Sorry. I've been unable to attach my HTML and XML files to this post. I keep getting messages that files in attachment can't have extensions of "XML", "HTML", "EX-EM-EL", "ACH-TEE-EM-EL" or any other variant I've tried. I've tried just attaching the file "Note" and received this error message "Files with the extension .note are not allowed as attachment in the message.".
The name of the XML file I attempted to attach was "note". No extension.
So here is the XML file that's being read:
I'll attempt to attach the HTML, without an extension.
Nope! "Files with the extension .responsexml are not allowed as attachment in the message."
The name of the HTML file I attempted to attach was "responseXML". No extension.
L Lindstrom wrote:
What's with the variables "xmlhttp" and "xmlDoc" in the code sample?
They aren't declared with "var" statements. Are var statements required?
The var is optional, and if omitted will create the variable in the global scope (the window object). It is considered sloppy and a poor practice to omit the var.
xmlhttp seems to be created in an if's condition braces. But it's used outside the braces. Any scoping issues?
Yes. It should be declared at the top level and set in the inner scope. That makes it explicitly clear what the scope of the variable is, rather then relying on the implicit global behavior of omitting var.