views:

113

answers:

2
A: 

I guess json_data rather needs to be an jQuery.ajax call:

"json_data" : $.ajax({
    "dataType": "json",
    "url" : base_url+"/json",
    "data" : function (n) {
        return { id : n.attr ? n.attr("id") : 0 };
    },
    error: function(e,b,d){alert(d);}
})
Gumbo
A: 

The JSON returned is valid. If i were to take a guess - maybe you need to specify the type. EG:

 $("#groups").jstree({
        "json_data": {
            "ajax": {
                "type": "POST",
                "url": base_url+"/json",
                "data": function (n) { return { id: n.attr ? n.attr("id") : 0} }
            }
        },
Byron Cobb
didn't work, it's already calling the Ajax since the error message shows me the invalid json... so it DOES get the Json but for some reason sees it as invalid
Asaf
You can validate your json at http://www.jsonlint.com/. The only difference between your json_data: and mine is that I assign a type and dont include the error. I assume you've put a break point on your url page to ensure that is the json you're getting back? If all of that is correct you might want to make your way to the jstree google groups - they're most active there and usually answer questions within the hour. http://groups.google.com/group/jstree
Byron Cobb