AJAX问题

I have a problem with my ajax script, I put in some alerts to see where the problem lies, here is my script:

<script language="javascript" type="text/javascript">
function positionUpdate(var1, var2){
alert ("1");
var queryString = "?var1=" + var1 + "&var2=" + var2;
alert ("2");
ajaxRequest.open("GET", "position_update.php" + queryString, true);
alert ("3");
ajaxRequest.send(null);
alert ("4");
}
</script>

Alert 3 doesn't show up when i run it so it looks like the problem is with this line but I don't know what it is:

ajaxRequest.open("GET", "position_update.php" + queryString, true);

Thanks, Stanni

You haven't instantiated the ajaxRequest object yet. At that point, it's still undefined.

You'll need to have this first:

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;
            }
        }
    }