Advertisement
Guest User

Comments-form.html

a guest
Jan 24th, 2019
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 0.97 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="it">
  3.     <head>
  4.         <meta charset="utf-8">
  5.     </head>
  6.     <body>
  7.         <form method="post" action="comments.php">
  8.             <p><input type="text" name="name"></p>
  9.             <p><textarea rows="10" cols="50" name="message"></textarea></p>
  10.             <p><input type="submit" name="save" value="save"></p>
  11.         </form>
  12.         <p>Comments</p>
  13.         <div id="comments"></div>
  14.         <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
  15.         <script>
  16.             $.ajax({
  17.                 type: "post",
  18.                 url: "comments.html",
  19.                 dataType: 'html',
  20.                 contentType: "text/html; charset=utf-8;",
  21.                 success: function(response) {
  22.                     $("#comments").html(response);
  23.                 },
  24.                 error: function(e){
  25.                     console.log(e.responseText);
  26.                 }
  27.             });
  28.         </script>
  29.     </body>
  30. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement