Jump to content

Archived

This topic is now archived and is closed to further replies.

twizler

xmldoc has no properties error, please help!!

Recommended Posts

I have been trying to get this code running. Here is my code as it stands. The error I am getting is xmldoc has no properties....

My code:

var XMLHttpRequestObject = false;
if(window.XMLHttpRequest){
XMLHttpRequestObject = new XMLHttpRequest();
}
else if(window.ActiveXObject){
XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
}

function showData(xmldoc){
var docElement, usernameNode, usernameidNode, displayText;

docElement = xmldoc.documentElement;
usernameNode = docElement.firstChild;
usernameidNode = usernameNode.nextSibling;

displayText = usernameNode.firstChild.nodeValue + ' ' + usernameidNode.firstChild.nodeValue;

var target = document.getElementById('usernameoutput');
target.innerHTML = displayText;

}
function getUsernames(){

var searchvalue = document.getElementById("uname").value;
var datasource = "search_profiles_now.php?searchvalue=" + searchvalue;

if(XMLHttpRequestObject){
document.getElementById('loadimage').style.display = "inline";
XMLHttpRequestObject.open("GET", datasource, true);

XMLHttpRequestObject.onreadystatechange = function()
{
if(XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200){
var xmldocument = XMLHttpRequestObject.responseXML;
showData(xmldocument);
document.getElementById('loadimage').style.display = "none";
}
}
XMLHttpRequestObject.send(null);
}
}

I am running firefox and have fire bug. My javascript is getting my xml data back to the browser but im still getting xmldoc has no properties. Any ideas?!

Share this post


Link to post
Share on other sites
Finally fixed my own issue. I was missing header("Content-type: text/xml"); in my xml document so javascript didnt know what it was looking at.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.