0

I've a site and i can read some info using "fetch", I use a file called 'orca.txt' in there i've some value, that i wanna use like a counter, so:

fetch('orca.txt')

.then(response => response.text())

.then(textString=> { contador =textString; });

When i've this var, contador, i cant build the filename to export like FN="File_"+contador;

So i need the counter adds 1. so if contador=2256, then it will be 2257.

contador++;

But now, how can I write this value at 'orca.txt' overwrite value to the next access have a new value?

I want to use JS if it's possible

1 Answers1

1

To send data to the server you need to use post method, you can check the MDN docs to see how to do it.

https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch#supplying_request_options

I am assuming that you have access to the server where you need to write a function to overwrite your octa.txt file on the sever itself.

a0m0rajab
  • 115
  • 7