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

136
Views
appending anchor in flask template using JavaScript

I have a table in a flask template, I am trying to append anchor to it using JavaScript:

Table:

<div class="box-body">
    <div class="table-responsive">
        <table class="table table-responsive mb-0 table-hover">
            <thead class="scroll-x">
                
            </thead>
            <tbody id='downloadPredictions'>
                
            </tbody>
        </table>
    </div>
</div>

JavaScript code:

$('#downloadPredictions').append("<td><a class='btn btn-primary' href='{{ url_for('download_corrected_file', dataset_id=dataset_id) }}'><i class='fa fa-download faicon' aria-hidden='true' title='Download'></i> Download Predictions</a></td>")

It sends following url:

http://127.0.0.1:5000/%7B%7B%20url_for(

I don't know what I am doing wrong in href while appending anchor. Any help please?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You have a syntax error in your JS .Make sure to use the correct quotation marks

$('#downloadPredictions').append("<td><a class='btn btn-primary' href='{{ url_for('download_corrected_file', dataset_id=dataset_id) }}'><i class='fa fa-download faicon' aria-hidden='true' title='Download'></i> Download Predictions</a></td>")

Should be

$('#downloadPredictions').append(`<td><a class='btn btn-primary' href="{{ url_for('download_corrected_file', dataset_id=dataset_id) }}"><i class='fa fa-download faicon' aria-hidden='true' title='Download'></i> Download Predictions</a></td>`)
about 4 years ago · Juan Pablo Isaza Report
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!