rendered paste body function add_comment(cID,email,comment){ var XHR = false; if(window.XMLHttpRequest){ XHR = new XMLHttpRequest(); }else if(window.ActiveXObject){ XHR = new ActiveXObject("Microsoft.XMLHTTP"); } if(XHR){ XHR.open("POST","comment.php",true); XHR.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); XHR.onreadystatechange = function(){ if(XHR.readyState == 4 && XHR.status == 200){ var pass = XHR.responseText; tPass = pass.replace(/^\s+|\s+$/g, ''); if(tPass == "yes"){ alert("Blah"); goCom = "yes"; }else{ alert("else"); goCom = "nope"; } } } XHR.send("action=add&cID="+encodeURI(cID)+"&email="+encodeURI(email)+"&comment="+encodeURI(comment)); } }