AJAX Poll: The JavaScript File

Which language do you like the most?

C/C++      Java      Lisp      Perl      PHP      Prolog      Python
When a user chooses an option above, a function called GetVote is executed. The getVote function does the following:
  1. Create an XMLHttpRequest object.

  2. Create the function to be executed when the server response is ready.

  3. Send the request off to a file on the server.

  4. A parameter (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