yungalig
yungalig

Reputation: 29

Changes to index.html on Elastic Beanstalk

I am creating a website on AWS ElasticBeanstalk for examining crypto and stock prices. Currently, in my code, I show a graph from TradingView which I got from their API page:

</script>
        <!-- TradingView Widget BEGIN -->
        <div class="tradingview-widget-container">
            <div id="tradingview_8ae14"></div>
            <div class="tradingview-widget-copyright">
            <a href="https://www.tradingview.com/symbols/NASDAQ-MSFT/" rel="noopener" target="_blank">
            <span class="blue-text">MSFR Chart</span>
            </a> by TradingView
        </div>

        <script type="text/javascript" src="https://s3.tradingview.com/tv.js"></script>
        <script type="text/javascript">
        new TradingView.widget(
        {
            "width": 980,
            "height": 610,
            "symbol": "NASDAQ:MSFT",
            "interval": "D",
            "timezone": "Etc/UTC",
            "theme": "Dark",
            "style": "1",
            "locale": "en",
            "toolbar_bg": "#f1f3f6",
            "enable_publishing": false,
            "allow_symbol_change": true,
            "container_id": "tradingview_8ae14"
        }
        );
        </script>
        </div>
        <!-- TradingView Widget END -->

On my website, the user can change the ticker symbol and from there my program will use regex and replace the "symbol": "NASDAQ:MSFT" line with the exchange name and the ticker symbol that the user specified. This works locally just as I would like. However, the TradingView graph does not change on ElasticBeanstalk. How can I make changes to the index.html file on AWS? Any help or pointers would be appreciated.

Upvotes: 0

Views: 411

Answers (1)

Arun Kamalanathan
Arun Kamalanathan

Reputation: 8593

Try to put the entire widget creation inside a function and call it every time the user selection changes, A similar question here, Change ticker of tradingview widget with an interval

Upvotes: 1

Related Questions