Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {"id":"value", "text":"value", "parent":"value"}
- $.ajax({
- url: "/category",
- dataType: 'json',
- type: 'GET',
- success: function (res) {
- $.each(res, function (i, obj) {
- products.push([obj.id, obj.parent, obj.text]);
- $('#jstree_demo_div').jstree({
- 'core': {
- 'data': [{ "id": obj.id, "parent": obj.parent != 0 ? obj.parent : "#", "text": obj.text }]
- }
- });
- console.log(obj.parent != 0 ? obj.parent : "#");
- });
- }
- });
- var objJS = new Object();
- objJS .id = ObjectJason.id;
- objJS .parent = ObjectJason.parent!=="0" ? ObjectJason.parent:"#";
- objJS .text = ObjectJason.text;
- $('#jstree_demo_div').jstree({
- 'core': {
- 'data': Array ;
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement