Reputation: 846
i have a json object in response, using that i have to create a jstree. But not able to read that json object in javascript function.
My 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);
});
the Response i can see in the firefox usinhg firebug. but how to read that json object from response.
Upvotes: 1
Views: 748
Reputation: 126
Try this:
$.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");
Upvotes: 1