SHARE
TWEET

Untitled

a guest Jun 17th, 2019 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. {"id":"value", "text":"value", "parent":"value"}
  2.      
  3. $.ajax({
  4.     url: "/category",
  5.     dataType: 'json',
  6.     type: 'GET',
  7.     success: function (res) {
  8.         $.each(res, function (i, obj) {
  9.             products.push([obj.id, obj.parent, obj.text]);
  10.             $('#jstree_demo_div').jstree({
  11.                 'core': {
  12.                     'data': [{ "id": obj.id, "parent": obj.parent != 0 ? obj.parent : "#", "text": obj.text }]
  13.                 }
  14.             });
  15.             console.log(obj.parent != 0 ? obj.parent : "#");
  16.         });
  17.  
  18.     }
  19. });
  20.      
  21. var objJS = new Object();
  22.  objJS .id = ObjectJason.id;
  23.  objJS .parent = ObjectJason.parent!=="0" ?  ObjectJason.parent:"#";
  24.  objJS .text = ObjectJason.text;
  25.      
  26. $('#jstree_demo_div').jstree({
  27.                 'core': {
  28.                     'data': Array ;
  29.                 }
  30.             });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top