I am currently working on a basic voting system. It functions perfectly when the two files are in the same location (locally).
However, once I publish it on my blogger platform, the system fails to display the results. (When a user clicks to vote, it registers on the web host, but the results do not appear!)
Here is the code I am using:
<script type="text/javascript">
function submitVote(int)
{
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)
{
document.getElementById("pollResults").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","http://mypollwebsite.com/vote.php?choice="+int,true);
xmlhttp.send();
}
</script>
<div id="pollResults">
<h3>What do you think?</h3>
<form>
Yes:
<input type="radio" name="vote" value="0" onclick="submitVote(this.value)" />
No:
<input type="radio" name="vote" value="1" onclick="submitVote(this.value)" />
</form>
</div>