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

185
Views
Rails | add ajax loading icon to remote: true

I have a link with remote: true attribute. It goes to the function then the js.erb file. My question is how can I add loading icon rails way?

For instance, if I put ajax request it is easy;

     $.ajax({
        type: 'POST',
        url: form.attr('action'),
        data: form.serialize(),
        dataType: 'json',
        beforeSend: function() {//add icon here}
        success: function(data){
        },
        error: function() {
        }
      });

But when I work with remote: true with link or button where should I put the loading icon.

PS: I do not want to add smth like below to the dom.

$('#mybutton').on('click', function(){$('#div-to-loading').prepend('.loading-icon')})

EDIT

Please read my question carefully. I know how to add loading icon with ajax call. I am asking how to do it with rails way. I have a link with remore:true option. It goes to controller action then rendering js file myfunc.js.erb.

Where should I put loading icon?

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!