xhr.onreadystatechange = setWord();
which runs setWord are attaches whatever is returned to be run whenever the readyState changes. At this point it is 0 which is not equal to 4.
You don't return anything from the setWord function and so there is nothing to actually run when the state does change to 1, 2, 3 and eventually 4.
To get setWord to run when the state changes you need to change that line to read:
xhr.onreadystatechange = setWord;
That way the function will not run now and will instead run when the state changes.