I have a page with a text box at the top, a submit button and below, a list of messages. I want that when you click on submit after you write something in the text box, the application saves the new message in the database and displays it without refreshing the page using Ajax. A new message should appear at the top of the message list. (I want a slide effect for a new message)
Now I wrote something like this:
$("#message_form").submit(function() { var dataString = $("#message_form").serialize(); $.ajax({ type: "POST", url: "/send_message", data: dataString, success: function(html) {
I am new and I donβt know what to write here and in the new function in views.py
:
def send_message(request): // what here?
Please can you help me?
source share