title: JQuery: what's the difference between these two $.get() methods?
body: <p><strong>Server:</strong></p>
  
  <pre><code>def csv_data(request): #mapped to url /csv_data
      with open('my_static_data.csv', 'r') as csv:
          response = HttpResponse(csv.read(), content_type="text/csv")
          response['Content-Disposition'] = 'attachment; filename="data.csv"'
      return response #returns the csv file
  </code></pre>
  
  <p><strong>Client:</strong></p>
  
  <p>1.</p>
  
  <pre><code>function csv_data() {
    var response = $.get('/csv_data');
    return response;
  }
  
  $(function () {
    var my_data = csv_data();
    console.log(my_data); //returns a response object
    console.log(my_data.responseText); //undefined?!
  }
  </code></pre>
  
  <p>2.</p>
  
  <pre><code>$(function () {
    $.get('/csv_data', function(d) {
      console.log(d); // returns csv_data. Why not the same response object?
    });
  }
  </code></pre>
  
  <p>The data returned by Method #2 is what I intended to use. Why is my_data.responseText is <code>undefined</code>, and why do these two methods return different objects?</p>