Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript">
- function PopUpShow(i) {
- $("#popup" + i).show();
- }
- function PopUpHide(i) {
- $("#popup" + i).hide();
- }
- function sendComment(message,user) {
- if (message == ""){
- document.getElementById("resultComment").innerHTML = "";
- return;
- } else {
- if (window.XMLHttpRequest) {
- xmlhttp = new XMLHttpRequest();
- } else {
- xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
- }
- xmlhttp.onreadystatechange = function() {
- if (this.readyState == 4 && this.status == 200) {
- document.getElementById("resultComment").innerHTML = this.responseText;
- }
- };
- xmlhttp.open("GET", "https://yoursite.com/comments.php?comment=" + message + "&user=" + user, true);
- xmlhttp.send(message);
- }
- }
- function PopUpSend(i, message, user) {
- $("#popup" + i).hide();
- sendComment(message);
- }
- </script>
- if (!empty($_SESSION['user'])){
- $user = $_SESSION['user'];
- $login = (string)$user->Login;
- echo '<a href="javascript:PopUpShow('.$i.')">Добавить комментарий</a>
- <div class="b-popup" id="popup'.$i.'">
- <div class="b-popup-content">
- <form method="post" class="form-horizontal">
- <label>Добавить комментарий</label>
- <br />
- <textarea type="text" name="comment" rows="8" cols="77"></textarea>
- <a class="btn btn-default" onclick="PopUpHide('.$i.');" role="button" style="width: 100%">Закрыть</a>
- <a class="btn btn-default" onclick="PopUpSend('.$i.',this.value,'.$login.');" role="button" style="width: 100%">Отправить</a>
- </form>
- </div>
- </div>';
- }
- <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