title: Using Flask url_for in button onclick location.href redirect leads to `Method Not Allowed`
body: <p>I'm in the middle of wire-framing out some basic forms and I'm hitting an unexpected <code>405 Method Not Allowed</code> blocker.</p>
  
  <p>Basically I have some html in a jinja template looking like...</p>
  
  <pre><code>&lt;!--Select File Y--&gt;
  &lt;tr&gt;
      &lt;td&gt;File Y&lt;/td&gt;
      &lt;td&gt;{{form.pathY }}&lt;/td&gt;
      &lt;td&gt;&lt;input type=file name=browse &gt;&lt;/td&gt;
      &lt;td&gt;&lt;button onclick="window.location.href='{{ url_for( 'dataTablePage' , table='Y' ) }}';"&gt;Display Table Y&lt;/button&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
      &lt;td/&gt;
      &lt;td/&gt;
      &lt;td/&gt;
      &lt;td&gt;&lt;a href="{{ url_for( 'dataTablePage' , table='Merged' ) }}"&gt;View Merged Data&lt;/a&gt;&lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>In the DOM this is rendering more or less what I'd expect as with the location.href = '/DataTable/Y/'
  <a href="https://i.stack.imgur.com/NSIAi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NSIAi.png" alt="Rough form with button"></a></p>
  
  <p>However when I click the button I wind up here in the <code>405 Method Not Allowed</code> page.
  <a href="https://i.stack.imgur.com/viy5P.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/viy5P.png" alt="405 Method Not Allowed"></a></p>
  
  <p>On the other hand the redirect works as expected when I redirect from anchors with url_for. What's the deal with using url_for in in a button's onclick redirection?</p>
  
  <p>Not sure if it matters, but here's the route I'm connecting to...</p>
  
  <pre><code>@app.route('/DataTable/&lt;table&gt;/')
  def dataTablePage(table) :
      """
      Takes the user to the Table View corresponding to the given table parameter
      """
      table == "X" :
          dfTable = DataFrame( data = {"X1":[1,2,3] , "X2":[2,3,4]} ) 
      elif table == "Y" :
          dfTable = DataFrame( data = {"Y1":[1,2,3,4,5] , "Y2":[2,3,4,5,6]} ) 
      elif table == "Merged" :
          dfTable = DataFrame( data = {"M1":[1,2] , "M2":[2,3]} ) 
      else :
          redirect( url_for('error') )
  
      return render_template( 'dataTable.html' , filePath="x.csv" , headers=dfTable.columns.values.tolist() , table=dfTable.iterrows() )
  </code></pre>