Text files won't read with jQuery until I manually load them in the browser

My site is inkchat.epizy.com.
Whenever I try to load a text file (log.txt) after editing it with php, it loads the pre-edit version! This happens until manually load the file to take a look at it, notice that the edit has occurred, and go back to see it refreshed! I tried to integrate an iframe, but it seems just as ineffective.

I’d like to help you, but I don’t fully understand what you’re doing here. You say you’re writing to the file with PHP and then try to load the file? How exactly are you loading the file? Are you loading it with a PHP script? Is it the same PHP script/request as the one which is writing the file or is it a separate request?

Based on your description, my first guess is that you’re trying to read the file before it was fully saved, but I’m not sure whether that applicable for your website.