Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

144
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda