For your very brief explanation, what I could understand is that you want to simply record a certain timestamp in a text file.
If you first thought of AJAX, you should at least keep in mind that there needs to be a server-side application (PHP, ASP, Python...) to perform the manipulation of the filesystem, effectively creating that file.
So, what’s the point of going all the way around, involving Javascript, obstructing your application, if a simple link pointing to a particular URL responsible for creating the file is enough? An example with PHP, since it is popular and I do not know what your server language:
<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 );
Aside from checking write permissions, I solved a specific problem in two lines, one of HTML and one of PHP.
If I’m wrong, edit your answer and provide more details. Help us help you.
that’s what you want?
– Filipe.Fonseca
@Filipe.Fonseca, I don’t understand..
– user7605
Can you define better what "didn’t work out" means?
– Guilherme Bernal
It’s not possible, look at reply down below.
– Silvio Andorinha
@Silvioandorinha, he didn’t put anything inside the file...
– user7605