How to use Javascript variable in an if condition in Django template?

I am currently working on a django template wherein I want to use a javascript variable in the if condition. My code is as follows

{% extends 'base.html' %}
{% block content %}

    <br>
    <div class="buttonRow">
        {% for t in tickerList %}
            <button class="btn btn-dark" onclick="changeChart(this.value)" value="{{ t }}">{{ t }}</button>
        {% endfor %}

    </div>
    <br><br>
    {% if {{ currentTicker }} %}
        {{ currentTicker |safe }}
    {% else %}
        <p>NO Graph</p>
    {% endif %}
{% endblock %}

<style>
    .buttonRow {
        width: 100%;
        float: left;
        border: solid 1px blue;
        text-align: center;
    }

    button {
        background: black;
        color: white;
    }
</style>

<script>


    var currentTicker = {{ tickerList.0 }}
        function changeChart(ticker) {
            currentTicker = ticker;
        }
</script>

Here the dictionary I send from the server-side may look like this

{
  "tickerList" : ["GOOGL","TSLA"],
  "GOOGL" : (plotly object),
  "TSLA" : (plotly Object)

}

Depending on the button clicked by the user I want to change the graph (plotly object) on the screen. As you can I have made the necessary buttons and I change “`currentTicker“ variable but I am not sure how I can change the graph in real-time on the screen when the user clicks the button. Could anyone help with this?