hello everyone,
I am a frontend developer studying Django, so please forgive my noobish question...
I am trying to make a simple ajax call working.
I have a form in a template. I would like to use that form to save an object into the database (asynchronously).
On form submit event:
* I prevent regular action
* I serialize form data in a JSON
* I pass that object to a view using a jquery POST
* The view receive the JSON data
* The view use the request.POST data to save an object into the database.
* The view returns a message.
Is that flow straightforward, or am I completely missing the goal?
Now some code and the error I got.
The relevant part of template:
And this is the error I got:
I noticed that in the view the request.POST is *empty*!
That is wrong, I suppose.
I am surely missing something.
Any help is really appreciated.
Thank you in advance,
carlo