I'm new to both these languages.

My delimma is this. I have a page which renders ABC musical notation. The load time of the page is like 1+seconds. I can render it much faster if I can change the variable in there and have it update the page. I contain the variable in a .js file (the variable is music).
I have one kind of solution (and you'll probably agree it's pretty terrible).
I put an endless time of 10 millisecods in my page which check to see if my .js page is updated and if so then loads it.

Is there a better way to do this?
Is there a way I can run an external script which will pass the music variable (which is a string) and also run a function in the webpage to re-render>

Cheers,
Sean