1

応答にjsonオブジェクトがあり、それを使用してjstreeを作成する必要があります。しかし、JavaScript関数でそのjsonオブジェクトを読み取ることができません。

私のJavaScript:

var repoId = $('#frmHdnV').val();
// variable to hold request
var request= $.post("CreatJqueryTree",{repoId:repoId},function(data){},"json");

request.done(function (response, textStatus, jqXHR){

    alert(response);

    var tem = JSON.parse(response);
    var obj = tem.data;
    $("#tes").jstree({ 
        "json_data" : {
            "data" : // here i need that json object to create this tree
        },
            "plugins" : [ "themes", "json_data", "checkbox", "ui" ]
        }).bind("select_node.jstree", function (e, data) { alert(data.rslt.obj.data("id")); });

}); 


request.fail(function (jqXHR, textStatus, errorThrown){


    alert("....Not Done...");
    alert(errorThrown);

});

応答は、firebug を使用して firefox で確認できます。しかし、そのjsonオブジェクトを応答から読み取る方法。

4

1 に答える 1

1

これを試して:

$.post("CreatJqueryTree",{repoId:repoId},function(data){
  $("#tes").jstree({ 
        "json_data" : {
            "data" : data
        },
            "plugins" : [ "themes", "json_data", "checkbox", "ui" ]
        }).bind("select_node.jstree", function (e, data) { alert(data.rslt.obj.data("id"));   });
},"json");
于 2013-08-12T17:56:54.597 に答える