title: Pass value to flask route when dropdown list change
body: <p>I have a flask template rendered with a default value in the route function. I am trying to change the value by selecting an option in the dropdown list. I managed to get the selected value to javascript as follows.</p>
  
  <p><strong>html template (dropdown list part only)</strong></p>
  
  <pre><code>&lt;div class="dropdown-menu scrollable-menu"&gt;
      &lt;a class="dropdown-item" data-attVal="1" href="#"&gt;Opt 1&lt;/a&gt;
      &lt;a class="dropdown-item" data-attVal="2" href="#"&gt;Opt 2&lt;/a&gt;
  &lt;div&gt;
  </code></pre>
  
  <p><strong>javascript</strong></p>
  
  <pre><code>$(".dropdown-menu a").click(function () {
    var selText = $(this).text();
    var selVal = $(this).attr("data-attVal");
  
    console.log(selText+":"+selVal);
  });
  </code></pre>
  
  <p><strong>app.py</strong></p>
  
  <pre><code>@app.route('/', methods=['GET','POST'])
  def display():
      i = 1
      # do many things based on value of i
  
      return render_template('display.html', response = data)
  </code></pre>
  
  <p>I don't really need javascript to communicate with my <code>flask app.py</code>. That was my initial thought. But I have no idea how to proceed after this or make a call to route <code>/</code> from my html template. I need to change the value of <code>i</code> based on the dropdown list <code>data-attVal</code>. </p>