JsonResponse of django returns empty

0

I am trying to make a query via ajax in django. the javscript part seems all right but when i go it returns the values in django my object always returns shift.

django.jQuery(document).ready(function(){
django.jQuery('#id_produto').change(function() {
    var pk = django.jQuery('#id_produto').val();
    //django.jQuery.each(pk, function(key,value){
    //         console.log(value);
    //     });
    request_url = '/pedidos/calcula_ajax/'+pk;



django.jQuery.get( request_url, function( data ) {
  django.jQuery( "#id_contato" ).html( data );
  alert( data ); //variavel data retorna nulo
});

  });
  });

the part of django ta this way

def pedido_calcula(request):
    #pedidos = get_object_or_404(Pedido, 4)
    #print(pedidos)
    
    c = 2 + 3
    return {'result': c}
    
asked by anonymous 20.08.2018 / 05:57

0 answers