Reputation: 142
I want to send information back-end via JS to update the database based on user response, but I don't need a JSON response or other HTTP rendering done. It's a test type app so all I'm sending back is a single identifier (integer) and boolean value to indicate pass/fail on their response.
Currently I am using a fetch(url/${identifier}/bool
) and all works as intended with the data management, but Python/Django throws an error as I am not returning any value.
So I have two questions.
Is fetch the right way of doing this as I am not actually expecting a response and I am doing no manipulation JS side with the data after calling it.
How can I stop Django from expecting a response on this as I intend to run the call as a simple function rather than an API call with JSON response sent back.
Thank you for the help.
Upvotes: 2
Views: 1597
Reputation: 142
Fixed the issue by simply using
return HttpResponse(status = 200)
Upvotes: 2