Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form method="POST" class="forma" name="sendMsg" id="ajax_form" action=""a>
- {% csrf_token %}
- <div class="input-container">
- <div class="input-group mb-3">
- <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>
- <div class="input-group-append">
- <button id="button" type="button" class="btn btn-outline-secondary" >Отправить</button>
- </div>
- </div>
- </div>
- </form>
- <script language="JavaScript">
- $(document).ready(function() {
- $('#ajax_form').button(function() { // catch the form submit event
- $.ajax({ // create an AJAX call...
- data: $(this).serialize(), // get the form data
- type: $(this).attr('method'), // GET or POST
- url: $(this).attr('action'), // the file to call
- success: function(response) { // on success..
- $('#sohbet').html(response); // update the DIV
- }
- });
- return false;
- });
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement