When a user chooses an option above, a function calledWhich language do you like the most?
GetVote
is executed.
The getVote
function does the following:
XMLHttpRequest
object.
vote
) with the value of the option is added to the URL.
function getVote( 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("poll").innerHTML = xmlhttp.responseText; } } xmlhttp.open( "GET", "PollVote.php?vote="+int, true ); xmlhttp.send( ); } |
A skeleton walks into a bar. The bartender says, “What’ll you have?” The skeleton says, “Gimme a beer and a mop.” — John Goodman |