I'm doing an AJAX function in angular where I pass a value for POST and it returns an object in JSON.
My AJAX function is this:
$http.post('/get_professional_info/', {idProfessional: id}).then(
function mySucces(response) {
// Hago mis cosas
}, function myError(response) {
// Informo error
});
In views.py I put the following:
def get_professional_info(request):
dic_id = request.POST['idProfessional']
professional = Profesional.objects.filter(id_profesional = int(idPro))
# El resto de las cosas...
The issue is that debugging I see that the information is being sent correctly. When I print the request.POST, this appears to me, which is defined as a QueryDict:
{'{"idProfessional":3}': ''}
How am I supposed to access that? I already tried with
request.POST['idProfessional']
and
request.POST.dict()['idProfessional']
And none works.