Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. setInterval(function(){
  2. let now = new Date();
  3. if(now.getSeconds() === 20){
  4. $.ajax({
  5. url: url,
  6. headers: { 'x-cyclops-ajax': 'yes' },
  7. method: 'POST',
  8. dataType: 'json',
  9. success: function(data) {
  10. var chart = $('#container').highcharts();
  11. var keys = Object.keys(data["histData"]);
  12. $( "#main-div" ).empty();
  13. for( var i=0; i< keys.length; i++) {
  14. chart.series[i].setData(data["histData"][keys[i]]["histFailure"], true);
  15. $('#main-div').append( '<div class="homepage-availability-inner-div"><h1 class="homepage-availability-text"> ' + keys[i] + ': <span class="dashboard-success">' + data["availData"][keys[i]] + ' </span> </h1></div>');
  16. }
  17. chart.xAxis[0].setCategories(data["histKeys"]);
  18. console.log("Data:" + JSON.stringify(data["availData"]));
  19. },
  20. error: function(jqXHR, textStatus, errorThrown) {
  21. console.log("Did not hit the AJAX call");
  22. }
  23. });
  24. }
  25. }, 1000);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement