Guest User

Untitled

a guest
May 26th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. $('.match-dates').on('afterChange', function () {
  2.  
  3. var currentSelectionDate = $('.match-dates .slick-current > div > div').attr('data-date');
  4. var liveStatus;
  5.  
  6. if(currentSelectionDate == null){
  7. liveStatus = 1;
  8. $.get('/api/index.php?request=GetLiveMatchesSpecial', function ( data ) {
  9. $('.lives').html(data);
  10. });
  11.  
  12. } else {
  13. liveStatus = 0;
  14. $.get('/api/index.php?request=GetFixturesSpecial&date=' + currentSelectionDate, function ( data ) {
  15. $('.lives').html(data);
  16. });
  17. }
  18.  
  19. if(liveStatus === 1){
  20. console.log(liveStatus);
  21.  
  22. setInterval(function () {
  23. $.get('/api/index.php?request=GetLiveMatchesSpecial', function ( data ) {
  24. $('.lives').html(data);
  25. });
  26. }, 5000);
  27. } else {
  28. console.log(liveStatus);
  29.  
  30. clearInterval();
  31.  
  32. }
  33.  
  34. });
  35.  
  36. let interval;
  37. $('.match-dates').on('afterChange', function() {
  38. var currentSelectionDate = $('.match-dates .slick-current > div > div').attr('data-date');
  39. var liveStatus;
  40. if (currentSelectionDate == null) {
  41. liveStatus = 1;
  42. $.get('/api/index.php?request=GetLiveMatchesSpecial', function(data) {
  43. $('.lives').html(data);
  44. });
  45. } else {
  46. liveStatus = 0;
  47. $.get('/api/index.php?request=GetFixturesSpecial&date=' + currentSelectionDate, function(data) {
  48. $('.lives').html(data);
  49. });
  50. }
  51. if (liveStatus === 1) {
  52. console.log(liveStatus);
  53. interval = setInterval(function() {
  54. $.get('/api/index.php?request=GetLiveMatchesSpecial', function(data) {
  55. $('.lives').html(data);
  56. });
  57. }, 5000);
  58. } else {
  59. console.log(liveStatus);
  60. clearInterval(interval);
  61. }
  62. });
Add Comment
Please, Sign In to add comment