Pull Text From a File

Hello all, I am trying to create a function that will pull text from a document that is included with the html webpage files on the server. There will be several different files that the function can pull from based on other variables.

The code below is obviously incomplete but im having issues getting any further. The first console.log command returns the value i am expecting but fmsPageText returns [object XMLHttpRequest]: {msCaching: "auto", onabort: null, onerror: null, onload: null, onloadend: null...} I am expecting it to have the text files contents. But im not sure where the issue is with my logic/syntax that is causing the issue.

var player = GetPlayer();
var fmsPageTitleJS = player.GetVar("fmsPageTitle");
var fmsPageNumJS = player.GetVar("fmsPageNum");
var fmsPageText;

function loadfmsPageTextFile(PageTitle, PageNum) {

	if (window.XMLHttpRequest) {
		fmsPageText = new XMLHttpRequest();
	else {
		fmsPageText = new ActiveXObject("Microsoft.XMLHTTP");

	fmsPageText.open("GET", ("fmsPages/"+(PageTitle)+(PageNum)+"Text.txt");

	fmsPageText.onreadystatechange = function() {