Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  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. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement