node-red flow variable in template

I’d like to be able to manipulate a flow variable in a template in a node-red flow.

In particular, the template is an HTML document, and in its body are a couple of lines:

`

LR LR data
BR BR data

`

that set up two buttons next to some data for a couple of rooms. The intent is that to see more information about one of these rooms, the user presses the corresponding button. Which button was pressed is communicated using a flow variable.

What I’ve tried is defining

`

function doIt(m) { flow.set(‘showMe’,m); }

`

This fails – and depending on how and where I try it, it can prevent the entire web page from loading. However,
(1) A similar line of code in a node-red function works just fine.
(2) The invocation of the doIt() function on pressing the button works. I can substitute alert(“blah blah”) for the call to flow.set() to see this.

So, what am I supposed to do to set a flow variable inside the HTML document of a template?

Many thanks!

Here I am answering my own question! Sorry. The answer is to use a web socket. I had tried that, unsuccessfully, before posting my question. The reason it failed seems to be that there were hidden items that I created when experimenting and that had not been removed when cleaning up. Now that they’re gone [go to config tab and remove things that shouldn’t be there] and a few other loose connections have been cleaned up, I’m getting the value I need where I need it!

My enlightenment came from the thread “2 instances of websocket” from 10/11/14: https://groups.google.com/forum/#!topic/node-red/Aek6xPFpFqI

Maybe this’ll help someone else, so I’m leaving it.