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

272
Views
Cómo acceder a la variable de plantilla de bigote desde otro archivo js externo

HTML

 <body> <p>Click "Add" button</p> <button id="btn-add">Add</button> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/mustache.js/2.3.0/mustache.min.js"</script> <script id="my-template" type="x-tmpl-mustache"> {{#users}} <div> <span class="name">{{name}}</span> </div> <div> <span class="comment">{{comment}}</span> </div> {{/users}} </script> <script src="./js/app.js"></script>

aplicación.js

 $("#btn-add").click(() => { $.get("http://myapis.com/api/users", (users) => { // *LOC // I want to set the #my-template users variable to the returned the users api response } });

Lo que estoy intentando / pensando que en LOC, de alguna manera acceda a los usuarios contenidos en #my-template y actualice su valor a la respuesta api de los usuarios (que es una matriz de objetos de usuarios). *

¡Gracias!

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!