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

192
Vistas
How I can calculate the sum of two numbers loaded from another page in jquery?

I want to use jquery and ajax to calculate the sum of 2 numbers for exemple, but every time I try from code, the part of the code that should calculate the numbers doesn't work, but it works in console if I paste it there. The first part of the code ( the one with extracting the numbers from another page) works even in inspect element if I look, the code is there. But the one that should calculate the sum isn't. What the best solution for this?

$.ajax({
        success: function () {
            $('body').append('<span class="invisible-total-messages" style= "display: hidden;">*</span>');
            parseInt($('.invisible-total-messages').load('/mesaje .msglist .errorbg').hide());
            var sum = 0;
            $('.invisible-total-messages .errorbg').each(function () {
                sum += parseInt($(this).text());
            });
            if (sum !== 0) {
                $('#menu .new_messages_count').html(sum);
            }
        }      
    });
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