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

201
Vistas
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?

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