Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.20 KB | None | 0 0
  1. <script type="text/javascript">
  2. function PopUpShow(i) {
  3. $("#popup" + i).show();
  4. }
  5.  
  6. function PopUpHide(i) {
  7. $("#popup" + i).hide();
  8. }
  9.  
  10. function sendComment(message,user) {
  11. if (message == ""){
  12. document.getElementById("resultComment").innerHTML = "";
  13. return;
  14. } else {
  15. if (window.XMLHttpRequest) {
  16. xmlhttp = new XMLHttpRequest();
  17. } else {
  18. xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  19. }
  20. xmlhttp.onreadystatechange = function() {
  21. if (this.readyState == 4 && this.status == 200) {
  22. document.getElementById("resultComment").innerHTML = this.responseText;
  23. }
  24. };
  25. xmlhttp.open("GET", "https://yoursite.com/comments.php?comment=" + message + "&user=" + user, true);
  26. xmlhttp.send(message);
  27. }
  28. }
  29.  
  30. function PopUpSend(i, message, user) {
  31. $("#popup" + i).hide();
  32. sendComment(message);
  33. }
  34. </script>
  35.  
  36. if (!empty($_SESSION['user'])){
  37. $user = $_SESSION['user'];
  38. $login = (string)$user->Login;
  39. echo '<a href="javascript:PopUpShow('.$i.')">Добавить комментарий</a>
  40. <div class="b-popup" id="popup'.$i.'">
  41. <div class="b-popup-content">
  42. <form method="post" class="form-horizontal">
  43. <label>Добавить комментарий</label>
  44. <br />
  45. <textarea type="text" name="comment" rows="8" cols="77"></textarea>
  46. <a class="btn btn-default" onclick="PopUpHide('.$i.');" role="button" style="width: 100%">Закрыть</a>
  47. <a class="btn btn-default" onclick="PopUpSend('.$i.',this.value,'.$login.');" role="button" style="width: 100%">Отправить</a>
  48. </form>
  49. </div>
  50. </div>';
  51. }
  52.  
  53. <a class="btn btn-default" onclick="PopUpSend(0,'123',admin);" role="button" style="width: 100%">Отправить</a>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement