Call JS Function from Button

Hey Guys. Should be easy but not working for me so looking for some help as to why not.

EXPECTED RESULTS:
Hit button >> Run Function getCartData()

SETUP

<button id="btn-cart-data" class="btn small" style="width: auto !important;" onclick="getCartData()">Get Cart Data</button>

getCartData() Function is located in the Head of the Page as a script

RESULT
Button does not actually run function (tried with both flows & static events) but the function does work if I call it directly from the console in the browser.

Any thoughts on this?

See quick video to show…

Community Page
Last updated: