I plan on using AJAX and requesting a text file, and when it is complete, read this file, and compare the text. Do you think that would not be enough?
No, this will be quite easy to hack. Yes, it's possible to find in the source code what file you are requesting and what value you are comparing its contents to.
So the most robust method is to read some actual data from the file, without which your game will not function properly. Like the inventory array, or some config values, or tilemap JSON etc. So even if hackers substitute or disable the file check, they will not be able to play the game without that data.
Of course, if you are not worried about hackers and just want to be able to temporarily lock/unlock it on the server, then you can simply check if the file contains some password.