I've got this far. How do I get the var type into the xmlhttp.onreadystatechange=function() so I can send it to a php script?
Code so far:
HTML Code:
<head>
<script type="text/javascript">
function display(el) {
  if (el.innerHTML == 'Send to Cart') {
        el.innerHTML = 'Sent to Cart';
        var type="sent";
  } else {
        el.innerHTML = 'Send to Cart';
        var type="send";
  }
  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) {
        ??????????
        }
  }
  xmlhttp.open("GET","livesearch.php?q="+str,true);
  xmlhttp.send();
}
</script>
</head>
<body>
<button  type="button" onclick="display(this)">Show Date</button>
</body>
</html>