Instead a plain string variable, you can use an object.
function sendRuest(someargums) {
var the_variable = {
data: null,
setData: function(data){ this.data = data;}
}
//here's that other function
request.onreadystatechange =
function() {
if (request.readyState == 4) {
switch (request.status) {
case 200:
//here the variable should be changed
the_variable.setData(request.responseXML);
}
return the_variable;
}
Anyway, your last line isn't going to work. When the function 'sendRuest' ends, the XHR request is not completed. You need to use timers to check the value of 'the_variable.data' (very bad) or use callbacks as stated in other answers.
Sergio.