I’m trying to run a tradingview widget in my app, adding an HTML block using the following code
https://pastebin.com/yjijN9Tx
But the only thing I get is a text saying
EURUSD Chart by tradingview, am I doing something wrong?
In Firefox or Chrome, press F12 to open the console to see if there are any error messages for the javascript.
If you get this error …
Uncaught ReferenceError: Error in custom code: TradingView is not defined
… then its trying to run the widget factory before the library has finished loading.
To fix this, wrap the script inside a callback function for document ready, i.e. …
<script type="text/javascript">
$(document).ready(function() {
new TradingView.widget({
"autosize": true,
"symbol": "FX:EURUSD",
...
"container_id": "tradingview_e50e9"
});
});
</script>
1 Like
This topic was automatically closed after 14 days. New replies are no longer allowed.