I use JSTree plugin to display department stricture. Serverside (asp.net 3.5) works well and I get JSON object.
But when I try:
$(document).ready(function () {
$('#btntst').click(function () {
$('#mainDiv').html('wait for data');
$.ajax({
type: 'POST',
url: '_layouts/GridView/ApplicationPage1.aspx/getTable',
contentType: "application/json; charset=utf-8",
dataType: 'json',
data: "{}",
success: function (msg) {
$('#jsTreeContainer').jstree({
"json_data": {
"data": [msg.d]
}
, "plugins": ["themes", "json_data"]
});
}
, timeout: 60000
});
});
});
I get only one node with all JSON string in it.
JSON-string, returned by webmethod is:
{
'data': 'department001',
'attr': {
'id': 'nodeid1773'
},
'children': [
]
},
{
'data': 'department001',
'attr': {
'id': 'nodeid1779'
},
'children': [
]
}
If I copy-paste this string to:
"json_data": {"data" : [...] }
I get correct result. Pleas help, can't get what am I doing wrong.