How to get the current value of a template variable via Javascript?

I would like to grab the current value of a template variable from a panel and use it as a parameter to be passed to a REST function. Is that possible? Which panel to use (HTML or AJAX) and how to grab the value?
I appreciate your response
Thanks a lot

you need write a custom panel for that and use templateSrv (angularJs service)

I ended up using an Text Panel with the following HTML (need to specify with [0] which template variable to use as there may be multiple ones)

Click Me!

See How to read a template variable from a plugin (PanelCtrl)? for an example of our to get the actual template varialbe

Where’s the html? :slight_smile: