This script keeps track of how many times it's been called. Note that storage values are always strings, which is the reason for the explicit tonumber type conversion. Also note that returning a Lua table results in a JSON response.

Script Code

Demo Code

The button below is controlled by the following JavaScript:

Try It!