title: jstree dynamic JSON data from django
body: <p>I'm trying to set up jsTree to dynamically accept JSON data from django.</p>
  
  <p>This is the test data i have django returning to jstree:</p>
  
  <pre><code>result=[{ "data" : "A node", "children" : [ { "data" : "Only child", "state" : "closed" } ], "state" : "open" },"Ajax node"]
  response=HttpResponse(content=result,mimetype="application/json")
  </code></pre>
  
  <p>this is the jstree code I'm using:</p>
  
  <pre><code>jQuery("#demo1").jstree({   
             "json_data" : {  
               "ajax" : {  
                  "url" : "/dirlist",  
                  "data" : function (n) {   
                      return { id : n.attr ? n.attr("id") : 0 };   
                  },
                   error: function(e){alert(e);}
               }  
           },  
          "plugins" : [ "themes","json_data"]
       });
  </code></pre>
  
  <p>All I get is the ajax loading symbol, the ajax error response is also triggered and it alerts "undefined".  I've also tried simpleJson encoding in django but with the same result.</p>
  
  <p>If I change the url so that it is receiving a JSON file with identical data, it works as expected.</p>
  
  <p>Any ideas on what the issue might be?</p>