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

143
Views
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
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!