I have searched for almost similar questions but none of those gave me the right answer. I have a fully working file_exist code in if else statement he
You can't call the PHP function from HTML/JS. PHP already finished it's work on server side when HTML/JS start working on the client side.
About file_exists - it doesn't change it's behavior in- or outside of function. So the problem should be in fil path. MAy be it's bacause you have /Project/events/folder-01/event-01.txt in the 1st case and /Alchemy/events/folder-01/event-01.txt in the 2nd? (Alchemy != Project)