I'm trying to pass two javascript variables to PHP. When there's only one then it's working but I have no clue how to send two at once. Here's my code
function save(nr) {
var xr = new XMLHttpRequest();
var url = 'saveColor.php';
var text = document.getElementById('color'+nr).value;
var vars1 = "newText="+text;
var vars2 = "variable="+nr;
xr.open("POST", url, true);
xr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xr.send(vars1);
}
So sending the "vars1" variable works fine, but where or how I should put "vars2" to send them at once? Something like
xr.send(vars1, vars2);
Doesn't work.