Index.cshtml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. @{
  2. ViewData["Title"] = "Telemor Anniversary";
  3. }
  4. <div class='center'>
  5. <p class='top'>Welcome to Telemor 10-year Anniversary Event</p>
  6. <img class='logo' src="logo 10 year.png" alt="logo" />
  7. <p class='name'><span class="gender"></span> <span class="fullname"></span></p>
  8. <p class='position'></p>
  9. <p class='company'></p>
  10. <img class="next" src="next.png" onclick="next()" alt="next" />
  11. </div>
  12. @section Scripts {
  13. <script>
  14. function loadGuest(next) {
  15. $.ajax({
  16. url: "/Home/RefreshGuestName",
  17. type: 'POST',
  18. data: {
  19. nextStatus: next
  20. },
  21. success: function (res) {
  22. console.log(res);
  23. if (res.error == "0") {
  24. // reload name
  25. $(".gender").html(res.gender);
  26. $(".fullname").html(res.name);
  27. $(".position").html(res.position);
  28. $(".company").html(res.organize);
  29. }
  30. },
  31. error: function (e) {
  32. console.log(e);
  33. }
  34. });
  35. }
  36. var timer;
  37. function next() {
  38. clearInterval(timer);
  39. loadGuest('1');
  40. timer = setInterval(loadGuest, 2000);
  41. }
  42. $(document).ready(function () {
  43. loadGuest("0");
  44. // interval
  45. timer = setInterval(loadGuest, 2000);
  46. });
  47. </script>
  48. }