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

233
Views
detener una función en ejecución al hacer clic en un botón

mi archivo html

 <script> let socket = io(); socket.on('update-value', function (value) { // When a 'update-value' event is received, execute the following code. console.log('received new value', value); // $('#myname').html(value); $('#div1').prepend(value); }); socket.on('checking-value', function (value) { // When a 'update-value' event is received, execute the following code. console.log('received new value', value); $('#name').prepend(value); }); function searchStart() { socket.emit('searchStart') const button = document.querySelector('#startbtn') button.disabled = true } function searchStop() { socket.emit('searchStop', 1) const button = document.querySelector('#stopbtn') button.disabled = true } </script>

archivo js del lado del servidor

 socket.on("searchStart", () => { runScript() }) socket.on("searchStop", () => { // ?????????? })

la función runScript tiene una tonelada de bucles for constantemente obteniendo datos y mostrándolos en la página html,

lo que quiero es hacer un botón de parada que detenga todos los bucles continuos y la "función runScript" de obtención de datos para que no se ejecute en el lado del servidor hasta que presione el botón de inicio nuevamente

about 4 years ago · Santiago Trujillo
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!