title: 405 : Method not allowed (AJAX query to Flask)
body: <p>I have seen a lot of questions on this and I am not able to debug this.</p>
  
  <p>My ajax query is this:</p>
  
  <pre><code>    function add_to_pipeline(){
          // console.log("In function");
          var mySelect = document.getElementById("select_list");
          var operator = mySelect.options[ mySelect.selectedIndex ].label;
          // console.log(mySelect.options[ mySelect.selectedIndex ].value);
          $("#pipeline_list").append('&lt;li&gt; '+ operator +'&lt;/li&gt;');
          submit_to_server();
      }
  
      function submit_to_server(){
          var img = new FormData();
          img.append('file',$("#preview_list li:last-child")[0]);
  
          // Debugging statement
          //$("#preview_list li:last-child").dialog();
              $.ajax({
              type : "POST",
              url : "/_process",
              data : img,
              contentType: false,
              cache: false,
              processData: false,
              success: function(data) {
                  alert(data['result']);
              }
          });
      }
  </code></pre>
  
  <p>The HTML is:</p>
  
  <pre><code>   &lt;select id="select_list"&gt;
               {% for l in list %}
                   &lt;option value={{ l.index }}&gt;{{ l.name }}&lt;/option&gt;
               {% endfor %}
     &lt;/select&gt;
     &lt;input type="button" id="p_submit" value="Add to pipeline" onclick="add_to_pipeline()"&gt;
  </code></pre>
  
  <p>The Flask file:</p>
  
  <pre><code>@app.route('/_process')
  def process():
      img = request.files['file']
      return jsonify(result="Image received")
  </code></pre>
  
  <p>I am taking the last <code>&lt;li&gt;</code> element of a <code>&lt;ul&gt;</code> as input file (images) and sending it through AJAX.</p>