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

304
Views
Cómo usar una alerta de función javascript dentro de una para cada ajax

Aquí está mi para cada uno en cuestión:

 (function() { //for legend tags const editText = (text) => `<p class="d-inline"><</p><p class="d-inline">${text.replace('<','').replace('>','')}</p><p class="d-inline">></p>`; $.ajax({ type: "GET", url: "/clinical/bbr-message-template-legend-list", dataType: "json", success: function (response){ var tbody=""; $.each(response.all_legends, function (key, legend) { tbody+='<tr>'+ '<td><a href="#" onclick="myFunction()">'+editText(legend.value)+'</a></td>'+ '<td>'+legend.text+'</td>'+ '</tr>'; }); $('#legend-list tbody').html(tbody) } });

Estoy tratando de recibir una alerta emergente cada vez que hago clic en las etiquetas a continuación (azul)

1

Intentando usar una función en: <a href="#" onclick="myFunction()">

pero cada vez que trato de usar una función dentro o fuera de ajax, mi función no se lee:

 function myFunction() { alert("I am an alert box!"); }

errores:

2

3

¿Cómo hago para que mi función sea leída?

Error en la consola:

 message-template:1 Uncaught ReferenceError: myFunction is not defined at HTMLAnchorElement.onclick
about 4 years ago · Juan Pablo Isaza
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!