title: How to get data out of request using jQuery and Flask
body: <p>For whatever reason, I'm having the hardest time getting the data I care about out of my request object in Flask. I'm trying to give the user a way to save their system of differential equations as different types of files that are generated server-side when the GET request is sent, I just need to know what file type they want. This is the code to send the request:</p>
  
  <pre><code>$.ajax({
              type: "GET",
              url: '/',
              data: selected_index,
              success: function(response){
                  console.log(response);
                  downString = response.downloadString;
              }
          });
  </code></pre>
  
  <p>and this is the code to choose which file to generate then send it back in a dictionary, so that <em>downString</em> is set to that file:</p>
  
  <pre><code>@app.route("/", methods=['GET','POST'])
  def index():
      if request.method=='GET':
          fileType = request.data
          if fileType=='ode':
              return jsonify({'downloadString':'ODE File Here'})
          if fileType=='mathematica':
              return jsonify({'downloadString':'Mathematica File Here'})
  </code></pre>
  
  <p>However, request.data is the empty string so I've been trying to work around that for quite a while and still haven't found a way. How can I get that piece of data from the request object?</p>