title: passing data wtih ajax using python's tornado in jupyterhub
body: <p>I am attempting to do something very simple. There is a modal on my page designed to show up whenever a button is clicked. The buttons are a cell in a  in my page's table. The button should launch the modal, and display data inside of that modal based on the rest of the row data. Specifically, one cell: the ID. I am using the python backend to grab a set of data from my DB based on the ID of the click. I have tried as hard as I can to make progress on this on my own. </p>
  
  <p>I am using jquery to handle the click, and all of this is running inside of a jupyterhub server. </p>
  
  <p>Here is the api method to fetch the id from the page:</p>
  
  <pre><code>JHAPI.prototype.api_request = function (path, options) {
      options = options || {};
      options = ajax_defaults(options || {});
      var url = utils.url_path_join(
          this.base_url,
          'api',
          utils.encode_uri_components(path)
      );
      $.ajax(url, options);
  };
  
  JHAPI.prototype.get_sg = function (sg_id, options) {
      console.log(sg_id);
      options = options || {};
      this.api_request(
          utils.url_path_join('securitygroup', sg_id),
          options
      );
  };
  </code></pre>
  
  <p>Here is the jquery on the page that calls it:</p>
  
  <pre><code> $(".rules").click(function () {
        var el = $(this);
        var id = $(this).closest("tr").find(".sgid").text();
        var dialog = $("#rules-dialog");
        dialog.find(".rules-sg").text(id);
        console.log(api.get_sg(id, {}));
        dialog.modal();
    })
  </code></pre>
  
  <p>and finally the python: </p>
  
  <pre><code>  class SecurityGroupAPIHandler(APIHandler):
    async def get(self, sg_id):
        data = ["test"]
        self.write(json.dumps(data))
  
    default_handlers = [
    (r"/api/user", SelfAPIHandler),
    (r"/api/securitygroup/([^/]+)", SecurityGroupAPIHandler),
    (r"/api/users", UserListAPIHandler), ...]
  </code></pre>
  
  <p>As you can see im not actually doing any of the DB fetching yet, im just trying to get the <code>console.log(get_sg(...)</code> to actually sucessfully log <em>something</em>. Currently it's returning undefined. However, the <code>console.log</code> inside of the <code>get_sg</code> function is being called successfully and printing the correct id, so I'm 99% sure this is happening on the python side. Thanks so much for your help!</p>