Jump to content


Photo

xmldoc has no properties error, please help!!


  • Please log in to reply
1 reply to this topic

#1 twizler

twizler
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 21 May 2006 - 04:59 AM

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?!

#2 twizler

twizler
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 21 May 2006 - 03:14 PM

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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users