Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. jQuery(function () {
  2. $.ajax({
  3. url: 'dept3.php'
  4. , type: 'GET'
  5. , data: {Sid: $("#Sid").val()}
  6. , success: function (data) {
  7. console.log('dept3.php 163');
  8. // console.log(data);
  9. var result = JSON.parse(data);
  10. console.log(result);
  11.  
  12. if (result.hasOwnProperty("error")) {
  13. alert(result.error);
  14. } else {
  15.  
  16. var $m = $("#menu");
  17. $.each(result.data, function(index, value){
  18. if (value.parentIsn == -1) {
  19. $m.append("<li class='isn-"+ value.isn +"' data-isn='" + value.isn + "'><a href='javascript:void(0)'><span>" + value.name + "</span></a><ul></ul></li>");
  20. } else {
  21. $('.isn-' + value.parentIsn).children('ul').append("<li class='isn-"+ value.isn +"' data-isn='" + value.isn + "' data-deptisn='" + value.isn + "'><a href='javascript:void(0)'><span>" + value.name + "</span></a><ul></ul></li>");
  22. }
  23. });
  24. $('#menu li li').each(function() {
  25. if ($(this).children('ul').children().length) {
  26. var isn = $(this).data('isn');
  27. var deptisn = $(this).data('deptisn');
  28. $(this).children('ul').children().first()
  29. .prepend("<li class='first' data-isn='" + isn + "' data-deptisn='" + deptisn + "'><a href='javascript:void(0)'><span>ะ’ัะต " + $(this).children('a').text() + "</span></a><ul></ul></li>");
  30. }
  31. });
  32. initMenu();
  33.  
  34. }
  35. }
  36. });
  37.  
  38. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement