Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

145
Vistas
Rails.Fire stop working after the first loop of setInterval from JS

I'm trying to make a site (just knowledge purpose) that updates every 15 seconds the price of CryptoCoins

To do that i made a setInterval loop and inside it, considering i have 4 coins, made a for iteration to get every element updated.

value_form = document.querySelectorAll("#value-form");
  const interval = setInterval(function() {
    for (var i = 0; i < value_form.length; i++){
      console.log(i)
      Rails.fire(value_form[i], 'submit')
   // Rails.handleRemote.call(value_form[i])  - Other method i tried but didnt worked as well
    }
  }, 15000);

But the problem is, after the first time it completes, the Rails.Fire stop tringerring, but the console.log(i) keep working normally... Can anyone explain why this happens?

PS. This is the element that make the value of the coin

 <td id="coin-<%= coin.id %>"><%= render "coin_value", coin: coin %>
   <%= form_tag(coins_path, method: :get , id: "value-form", remote: true) do %>
     <%= hidden_field_tag "acronym", "#{coin.acronym}"%>
   <% end %>
 </td>

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda