twizler Posted May 21, 2006 Share Posted May 21, 2006 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?! Quote Link to comment Share on other sites More sharing options...
twizler Posted May 21, 2006 Author Share Posted May 21, 2006 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.