2👍
✅
I don’t think Django does automatic serialization for dictionaries. You’ll have to serialize them to JSON by hand.
import simplejson
# ...
return HttpResponse(simplejson.dumps(data), mimetype="application/json")
0👍
You don’t show the code that triggers the ajax_call
function. If it’s as part of the onclick
event for a submit button, or the onsubmit
event for a form, the usual cause is that you’ve forgotten to prevent the form from submitting normally – so the page refreshes and the Ajax call is lost.
Use event.preventDefault()
in your event handler to fix this.
- [Answered ]-Dockerized Django On Ubuntu
- [Answered ]-Requirements.txt bad interpreter: No such file or directory
- [Answered ]-Django form geocoding – where to geocode, how to validate, how to pass geocode result
- [Answered ]-Nginx – permanent redirect to amazon s3 if one media file doesnot exist locally
Source:stackexchange.com