Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. [
  2. {
  3. "alias": "Server1",
  4. "hostgroup_worst_service_state": "0",
  5. "status_history": {
  6. "status": [
  7. "0",
  8. "2",
  9. "0",
  10. "0"
  11. ]
  12. }
  13. },
  14. {
  15. "alias": "Server2",
  16. "hostgroup_worst_service_state": "0",
  17. "status_history": {
  18. "status": [
  19. "0",
  20. "0",
  21. "0",
  22. "0"
  23. ]
  24. }
  25. },
  26. {
  27. "alias": "Server3",
  28. "hostgroup_worst_service_state": "0",
  29. "status_history": {
  30. "status": [
  31. "1",
  32. "1",
  33. "1",
  34. "0"
  35. ]
  36. }
  37. }
  38. ]
  39.  
  40. $.each(data, function(i, item) {
  41. console.log(item.alias)
  42. console.log(item.hostgroup_worst_service_state)
  43. }
  44.  
  45. ["0","2","0","0"]
  46. ["0","0","0","0"]
  47. ["1","1","1","1"]
  48.  
  49. $.each(data, function () {
  50. console.log(this.status_history.status);
  51. });
  52.  
  53. $.each(data, function (i, item) {
  54. console.log(item.status_history.status);
  55. });
  56.  
  57. var arr = $.map(data, function (el) {
  58. return [ el.status_history.status ];
  59. });
  60.  
  61. var result = [];
  62.  
  63. for(var i = 0; i < data.length; i++) {
  64. result.push(data[i].status_history.status);
  65. }
  66.  
  67. for(i=0;i<data.length;i++)
  68. {
  69. console.log(data.status_history.status);
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement