function getText(url, callback) {
var request = new XMLHttpRequest();
request.open("GET", url);
request.onreadystatechange = function() {
if (this.readyState == 4)
callback(this.responseText);
};
request.send(null);
}
var n = 2;
getText('/file.txt', function(text) {
var numbers = text.split(' '); // text.split(' ').map(Number)
var contains = numbers.indexOf(String(n)) > -1;
alert(contains ? 'Ага' : 'Неа');
});