Advertisement
Guest User

Untitled

a guest
Jul 12th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.               <form method="POST" class="forma" name="sendMsg" id="ajax_form" action=""a>
  3.                   {% csrf_token %}
  4.                   <div class="input-container">
  5.                       <div class="input-group mb-3">
  6.                           <textarea name="msg" style="min-height:50px; max-height:150px;" required type="text" class="form-control" placeholder="Введите Ваше сообщение" aria-label="Recipient's username" aria-describedby="button-addon2"></textarea>
  7.                           <div class="input-group-append">
  8.                               <button id="button"  type="button" class="btn btn-outline-secondary" >Отправить</button>
  9.                           </div>
  10.                       </div>
  11.                   </div>
  12.               </form>
  13.  <script language="JavaScript">
  14.     $(document).ready(function() {
  15.         $('#ajax_form').button(function() { // catch the form submit event
  16.             $.ajax({ // create an AJAX call...
  17.                 data: $(this).serialize(), // get the form data
  18.                 type: $(this).attr('method'), // GET or POST
  19.                 url: $(this).attr('action'), // the file to call
  20.                 success: function(response) { // on success..
  21.                     $('#sohbet').html(response); // update the DIV
  22.                 }
  23.             });
  24.             return false;
  25.         });
  26.     });
  27. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement