How to link this jscode (Onclick ) to the respective button

How to link this jscode (Onclick) to the respective button

@divhunter

Def need more information on this one :smiley: What do you mean by “link this jscode”.

Onclick of a button I have to fetch data from API & display it in UI.

Do that I have to write some js code.

How should I link the Onclick method code to the respective button