fsociety7

carica_altro

Aug 10th, 2017
75
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <center>
  2. <button id="button_loading" class="btn btn-default" onclick="showCommentPost()"><span class="fa fa-spinner fa-2x"></span> Carica altri commenti</button>
  3. <p id="loading" style="display:none;"><i class="fa fa-spinner fa-spin fa-5x"></i></p>
  4. <p id="all_comments" style="display:none;">Tutti i commenti sono stati visualizzati.</p>
  5. </center>
  6. <br><br><br>
  7. <script>
  8. var i = 1;
  9. var pst = <?php echo $id;?>;
  10. var com = <?echo $number_comm;?>;
  11. var pagination = <?echo $pagination;?>;
  12. alert(pst + " "+ " " +com + " "+pagination);
  13. alert("control/comments.php?post="+pst+"&comment="+com+"&one=<?php echo $password;?>");
  14. function showCommentPost() {
  15. if (pst == "") {
  16. document.getElementById("comments_show"+i).innerHTML = "";
  17. return;
  18. } else {
  19. if (window.XMLHttpRequest) {
  20. // code for IE7+, Firefox, Chrome, Opera, Safari
  21. xmlhttp = new XMLHttpRequest();
  22. } else {
  23. // code for IE6, IE5
  24. xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  25. }
  26. xmlhttp.onreadystatechange = function() {
  27. if (this.readyState == 4 && this.status == 200) {
  28.  
  29. hide_loading_Comment()
  30. show_loading_Circle();
  31. alert("documento prova" + pst + " "+ " " +com + " "+pagination );
  32. document.getElementById("comments_show"+i).innerHTML = this.responseText;
  33. alert("documento prova");
  34. if(i==pagination)
  35. {
  36. hide_loading_Comment();
  37. hide_loading_Circle();
  38. show_all_comments();
  39. }
  40. else
  41. {
  42. $(document).ready(function ()
  43. {
  44. alert("documento caricato ora mostro il tasto carica altro");
  45. hide_loading_Circle(); show_loading_Comment();
  46. });
  47. }
  48.  
  49. i++;
  50.  
  51. }
  52. };
  53. xmlhttp.open("GET","control/comments.php?post="+pst+"&comment="+com+"&one=<?php echo $password;?>",true);
  54. xmlhttp.send();
  55. }
  56. }
  57.  
  58.  
  59. function hide_loading_Comment() {
  60.  
  61. var button_loading = $('#button_loading');
  62. button_loading.hide("fast");
  63. }
  64.  
  65. function show_loading_Comment() {
  66.  
  67. var button_loading = $('#button_loading');
  68. button_loading.show("fast");
  69. }
  70.  
  71. function show_loading_Circle() {
  72.  
  73. var loading = $('#loading');
  74. loading.show("fast");
  75. }
  76.  
  77. function hide_loading_Circle() {
  78.  
  79. var loading = $('#loading');
  80. loading.hide("fast");
  81. }
  82.  
  83. function show_all_comments() {
  84.  
  85. var all_comments = $('#all_comments');
  86. all_comments.show("fast");
  87. }
  88.  
  89. </script>
RAW Paste Data