Pass a variable to an ajax function
<p>I'm trying to pass a variable to a javascript function, but I'm not sure what's going on as I am primarily a PHP person.</p>

<pre><code>&lt;script language="javascript" type="text/javascript"&gt;
&lt;!-- 
//Browser Support Code
function ajaxFunction( str){
    var ajaxRequest;  // The variable that makes Ajax possible!

    try{
        // Opera 8.0+, Firefox, Safari
        ajaxRequest = new XMLHttpRequest();
    } catch (e){
        // Internet Explorer Browsers
        try{
            ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try{
                ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e){
                // Something went wrong
                alert("Your browser broke!");
                return false;
            }
        }
    }
    // Create a function that will receive data sent from the server
    ajaxRequest.onreadystatechange = function(){
        if(ajaxRequest.readyState == 4){
            document.getElementById("emailconfirm").innerHTML= ajaxRequest.responseText;
        }
    }

    ajaxRequest.open("GET", "Atest.php?Email="+str, true);
    ajaxRequest.send(null); 
}

//--&gt;
&lt;/script&gt;           
</code></pre>

<p>the form</p>

<pre><code>&lt;form name='myForm'&gt;

    &lt;input name="email"   id="email"type="text" /&gt;
    &lt;input name="button" onclick="ajaxFunction(document.getElementById('email').value" type="button" /&gt;
&lt;/form&gt;
</code></pre>

<p>I wanna be able once the button get clicked, the email text input will be passed to the javascript function.</p>
