Tengo una tabla en una plantilla de matraz, estoy tratando de agregarle un ancla usando JavaScript:
Mesa:
<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>Código JavaScript:
$('#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>")Envía la siguiente url:
http://127.0.0.1:5000/%7B%7B%20url_for(No sé qué estoy haciendo mal en href al agregar el ancla. ¿Alguna ayuda por favor?
Tiene un error de sintaxis en su JS. Asegúrese de usar las comillas correctas
$('#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>")Debiera ser
$('#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>`)