title: AJAX Maximum call stack size exceeded
body: <p>I have a javascript function that reads an xml. From that function, it calls a second function to prompt the user to update the start price value. It successfully does it the first time then has this error.
  2
  Uncaught RangeError: Maximum call stack size exceeded.
  43
  Uncaught InvalidStateError: Failed to execute 'send' on 'XMLHttpRequest': The object's state must be OPENED.</p>
  
  <p>I am not sure what is going on here? Is it a recursion problem? If so, how can i solve this?</p>
  
  <p>This is the javascript:</p>
  
  <pre><code>var xmlhttp=false;
  if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest();
  }
  else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
  
  function loadXMLDoc()
  {
  var table
  var i;
  xmlhttp.open("GET","auction.xml",false);
  xmlhttp.send();
  xmlDoc=xmlhttp.responseXML; 
  
  table=("&lt;table border='1'&gt;&lt;tr&gt;&lt;th&gt;Item Name&lt;/th&gt;&lt;th&gt;Category&lt;/th&gt;&lt;th&gt;Start   Price&lt;/th&gt;&lt;/tr&gt;");
  var x=xmlDoc.getElementsByTagName("Product");
  for (i=0;i&lt;x.length;i++)
  { 
  table+=("&lt;tr&gt;&lt;td&gt;");
  table+=(x[i].getElementsByTagName("ItemName")[0].childNodes[0].nodeValue);
  iname=(x[i].getElementsByTagName("ItemName")[0].childNodes[0].nodeValue);
  table+=("&lt;/td&gt;&lt;td&gt;");
  table+=(x[i].getElementsByTagName("Owner")[0].childNodes[0].nodeValue);
  iowner=(x[i].getElementsByTagName("Owner")[0].childNodes[0].nodeValue);
  //document.getElementById('test').innerHTML=iowner;
  table+=("&lt;/td&gt;&lt;td&gt;");
  table+=(x[i].getElementsByTagName("StartPrice")[0].childNodes[0].nodeValue);
  table+=("&lt;/td&gt;&lt;td&gt;");
  table+="&lt;input type=\"submit\" onclick=\"itembid('"+ iname + "','"+ iowner +"')\" value=\"Bid\"&gt;";
  table+=("&lt;/td&gt;&lt;/tr&gt;");
  }
  table+=("&lt;/table&gt;");
  document.getElementById('listinglist').innerHTML=table;
  }
  
  function itembid(iname,iowner)
  {
  var newbid = prompt("Please enter your bidding price");
  var itemname = iname;
  var ownername = iowner;
  //document.getElementById('test').innerHTML=ownername;
  //document.getElementById('test').innerHTML="AA";
  xmlhttp.open("GET", "readxml.php?newbid=" + encodeURIComponent(newbid) + "&amp;itemname=" + encodeURIComponent(itemname) + "&amp;ownername=" + encodeURIComponent(ownername) +"&amp;date="+ Number(new Date), true);
  xmlhttp.onreadystatechange = loadXMLDoc;
  xmlhttp.send();
  }
  </code></pre>