title: How do i stop data from resubmitting when reloaded on Flask?
body: <p>When the page is reloaded, the data is resubmitted into the <code>notes[]</code> list, and is then printed out as shown in the html code. How do I prevent a POST request to happen on a reload, instead have GET run?</p>
  <pre><code> app=Flask(__name__)
   notes=[]
   @app.route(&quot;/&quot;, methods=[&quot;GET&quot;, &quot;POST&quot;])
   def index():
        if request.method == &quot;POST&quot;:
           note = request.form.get(&quot;note&quot;)
           notes.append(note)
           return render_template(&quot;index.html&quot;, notes=notes)
        else:
           return render_template(&quot;index.html&quot;)
  </code></pre>
  <p>on html</p>
  <pre><code>  &lt;form action=&quot;{{url_for('index')}}&quot; method=&quot;post&quot; onsubmit=&quot;return false&quot;&gt;
    &lt;input type=&quot;text&quot; name=&quot;note&quot; placeholder=&quot;insert note&quot;&gt;
    &lt;button&gt;submit&lt;/button&gt;
  
    &lt;/form&gt;
    &lt;ul&gt;
   {%for note in notes%}
   &lt;li&gt;{{note}}&lt;/li&gt;
    {%endfor%}
    &lt;/ul&gt;
  </code></pre>
  <p>What is the issue and how do I fix it?</p>