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

169
Vistas
Use list from flask in javascript as array

With javascript I want to insert a select with options:

function newRow() {

  var tbodyRef = document.getElementById('myTable').getElementsByTagName('tbody')[0];
  var lastRow = tbodyRef.rows[tbodyRef.rows.length - 1];
  var lastCell = lastRow.cells[lastRow.cells.length - 1];  
  var newCell = newRow.insertCell();
  newCell.innerHTML = '<select name="reportList" method="GET" action="/">'+
                '<option value="data">data.value</option>' +
            '</select>';
}

At the bottom of my HTML file:

<script>var data = '{{ reportList | tojson }}';</script>

My question is how can I use the reportList list in my javascript as options (in place of data.value). Right now, 'data' variable is a string and not an array, do I have to split it into a string or is there another way?

about 4 years ago · Santiago Gelvez
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