Na výsledek se nečeká, ten je dostupný až v xhttp.onreadystatechange. Takže práci s ním přesuň do té funkce.