title: Sending a dictionary from JS to Flask via AJAX
body: <p>I'm trying to send data in a dictionary format from the client side JavaScript to the server back end via AJAX. It is working, however the data received on the Python end is not what I expected.</p>
  
  <pre><code>&gt;&gt;&gt; b'new+class=some_valaue&amp;document+id=1234567'
  </code></pre>
  
  <p>What I am expecting back is:</p>
  
  <pre><code>{'new class': 'some_value', 'document id': 1234567}
  </code></pre>
  
  <p>My javascript</p>
  
  <pre><code>    $.ajax({
              url: '/reclassify',
              data: {'new class': 'some_value',
              'document id': 1234567,},
              type: 'POST',
              success: function(response){
                  console.log(response);
              },
              error: function(error){
                  console.log(error);
              }
          });
  </code></pre>
  
  <p>My Python/Flask</p>
  
  <pre><code>@app.route('/reclassify', methods=['POST'])
  def reclassify():
      data = request.get_data()
      print(data)
      return 'success'
  </code></pre>
  
  <p>I don't have any if POST statements yet because I'm still trying to figure out how to get the data sent across in the right format.</p>