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:
<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) {
<button  type="button" onclick="display(this)">Show Date</button>