I am looking for a way to transfer information from an HTML page to a script file that is contained within the same page. My initial thought was to use a global variable defined in the page and then accessed in the script file.
However, I understand that using global state is generally discouraged due to potential issues. So, I have been exploring alternative methods for passing data from the HTML page to the script file without relying on global variables. Unfortunately, I have not come across any solutions so far.
I am wondering if there are other possibilities for accomplishing this task. Any suggestions or thoughts would be greatly appreciated?