title: How to pass django ajax data to template?
body: <p>I'm trying to pass a 2d array into a template via ajax. I managed to get the data from the server on click, but I don't know how I can handle that data inside a template. For instance, if I put the returned 'data' into a div then it just lists the first column. How to access specific data with, for instance:</p>
  
  <pre><code>{% for printers in printer_list %}
      {{ printer.email }}
  {% endfor %}
  </code></pre>
  
  <p>Javascript:</p>
  
  <pre><code>$(".printersToggle").click(function() {
      $.get("/ajax", function(data) {
          /* What goes here? */
      });
  });
  </code></pre>
  
  <p>views.py:</p>
  
  <pre><code>def ajax_test(request):
      if request.is_ajax():
          printer_list = User.objects.all()
      else:
          printer_list = "Not ajax"
      return HttpResponse(printer_list)
      # Am I doing this bit right?
  </code></pre>
  
  <p>urls.py:</p>
  
  <pre><code>url(r'^ajax$','website.views.ajax_test'),
  </code></pre>