Jump to content

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?!
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.