title: Displaying results on the same page with Flask
body: <p>I am trying to write code that will request data for a page, process it, and then show the result in a lower section of the page without refreshing. </p>
  
  <p>Flask code:</p>
  
  <pre><code>    if request.method == 'GET':
          return render_template("dashboard.html", data_nodes=data_nodes, data_para=data_para)
      elif request.method=='POST':
          #c, conn = connection2()
          select1 = request.form.get('node')
          select2 = request.form.get('parameter')
          print str(select1)
          print str(select2)
          #processes the data
          #display the processed data on the same page
          #return render_template("dashboard.html") This will refresh the page! Is there another way? 
  </code></pre>
  
  <p>My HTML side</p>
  
  <pre><code>        &lt;form method="POST" action="{{ url_for('dashboard')}}"&gt;
              &lt;label for="node"&gt;Node&lt;/label&gt;
              &lt;select name="node"&gt;
                  {% for o in data_nodes %}
                  &lt;option value="{{ o.name }}"&gt;{{ o.name }}&lt;/option&gt;
                  {% endfor %}
              &lt;/select&gt;
              &lt;label for="parameter"&gt;Parameter&lt;/label&gt;
              &lt;select name="parameter"&gt;
                  {% for o in data_para %}
                  &lt;option value="{{ o.name }}"&gt;{{ o.name }}&lt;/option&gt;
                  {% endfor %}
              &lt;/select&gt;
              &lt;button type="submit" class="btn btn-default" &gt;Send&lt;/button&gt;
          &lt;/form&gt;
  </code></pre>
  
  <p>Is there a way to post the processed data without having to redirect to another page? </p>