AJAX xmlhttp.send参数

I have created an AJAX function that when called it changes the color of a specific button. However, I have only managed to do it in a static way, meaning that I put the values sent to the corresponding php script manually. What I want is to call the function through my html body with some parameters and then these parameters should be passed through the xmlhttp.send method. I tried but it doesn' work. For example a call to the below function ajaxFunction() will work OK (it will pass two parameters x=0 and t=1)

    $ function ajaxFunction() { ... xmlhttp.open("POST","example.php",true); 
xmlhttp.onreadystatechange = handleServerResponse;
xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlhttp.send("x=0&t=1");}

But when I try to call the function with some parameters (ajaxFunction(0,1) then how can I put these values in the xmlhttp.send method?

Any ideas?

Thanks anyway.

did you mean:

function ajaxFunction(arg0, arg1) {
    // ... new + open + setRequestHeader
    xmlhttp.send('x=' + encodeURIComponent(arg0) + '&t=' + encodeURIComponent(arg1));
}