By your very brief explanation, what I could understand is that you simply want to record a certain timestamp in a text file.
If you first thought about AJAX, you should either at least keep in mind that there needs to be a server side application (PHP, ASP, Python ...) to handle the filesystem , effectively creating this file.
So what's the point of going all that way, involving JavaScript, blocking your application, if a simple link pointing to a particular URL responsible for creating the file is enough? An example with PHP is seen to be popular and I do not know what your server language is:
<a href="/path/to/my/resource.php">Gerar Aquivo</a>
<?php file_put_contents( 'aviso.txt', date( 'd/m/Y - H:i:s' ) . "\n", FILE_APPEND );
Disregarding write permissions checking, I solved a specific problem in two lines, one of HTML and one of PHP.
If I'm wrong, please edit your answer and provide more details. Do not help us help you.