Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

167
Vistas
Python dictionary in jQuery

I've an ajax call in my html of a django application. How can I handle the returned object in javaScript if my python backend returns a list that includes python dictionary:

html:

$.ajax({
        type: "GET",
        url: '/api/check_variable/?name='+$("#foo").val()+'&stat='+stat_id,
        data: "check",
        success: function(response){
            alert("response[2]);
        } 
)}   

urls.py:

    urlpatterns = [
        path("check_variable/", views.api_for_class_checking, name="check_variable"),
    ]   
    

views.py:

    def api_for_class_checking(request, **kwargs):
        
        return ['id1', 'id2',{'filabel': 'label F', 'svlabel': 'labelS', 'enlabel': 'labelEn'}]     

In this case my html page alerts just Object as response[2]. How can I get the attributes of the returned object, like the value of 'filabel' e.g. ?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

There is nothing wrong to your code because your ajax call returned an object:

{'filabel': 'label F', 'svlabel': 'labelS', 'enlabel': 'labelEn'}

If you want to alert an attribute of your returned data(for example: filabel) you can try this in your ajax call:

alert(`${response[2].filabel}`); 

Or,

alert(`${response[2]["filabel"]}`); 
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda