var curAnswer = 1; //ajax function createXMLHttpRequest() { try { //non IE browsers return new XMLHttpRequest(); } catch(e) { //IE try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { alert("Action Failed: Your browser doesn't seem to support AJAX!"); } } } return null; } function showResults() { var conn = createXMLHttpRequest(); conn.onreadystatechange = function() { if(conn.readyState ==4) { if(conn.status == 200) { document.getElementById("divSurveyContainer").innerHTML = conn.responseText; } } } conn.open("GET", "showresults.php", true); conn.send(null); } function processVote() { var conn = createXMLHttpRequest(); conn.onreadystatechange = function() { if(conn.readyState ==4) { if(conn.status == 200) { document.getElementById("divSurveyContainer").innerHTML = conn.responseText; } } } conn.open("GET", "processvote.php?votedoption="+curAnswer, true); conn.send(null); }