Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

167
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!