Hello,

I am a longtime PHP developer and fairly skilled in javascript at least enough to work around. I am brand new to XML and one of the companies i cooperate with require me to post an XML file to their website so i can retrieve different information. I have a XML posting tool i have been experimenting with but it does not seem to ever come back with a response. What am i doing wrong?

Code:
<html>
<head>
<script type="text/javascript">
function loadXMLDoc()
{

var xmlhttp;
var txt,x,i;
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    xmlDoc=xmlhttp.responseXML;
    txt="";
    x=xmlDoc.getElementsByTagName("SomeElementName");
    for (i=0;i<x.length;i++)
      {
      txt=txt + x[i].childNodes[0].nodeValue + "<br />";
      }
    document.getElementById("myDiv").innerHTML=txt;
    }
  }
xmlhttp.open("POST","[URL of business I send XML to]",true);
xmlhttp.setRequestHeader("Content-Type","application/xml");
xmlhttp.setRequestHeader("Content-Length","100");
xmlhttp.send('apidata=[LITERAL XML code that website requires in order to process my request]');
}
</script>
</head>

<body>

<h2>My Collection:</h2>
<div id="myDiv"></div>
<button type="button" onclick="loadXMLDoc()">Get my collection</button>

</body>
</html>