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

191
Vistas
Javascript: records to be displayed in new line when there are more than one record

Please help me with this.

This is my code to get role, first name and last name from a database. If there are more than one record, the results should get printed in a new line. I tried adding '\n' and <br> tags to get the data to a new line but it didn't work. I tried for loop but it pulls the records more than once and I get duplicate values as below.

ObjAssociatedPartyLocal_tab = variable for first name and last name
ObjAssociatedPartyRole_tab = variable for the role of that person

The result I'm getting is

testrole1 : Test_Last, Test_First testrole1 : testlast2, testfirst2 testrole2 : Test_Last, Test_First testrole2 : testlast2, testfirst2

However, it should be displayed like this,

testrole1 : Test_Last, Test_First,
testrole2 : testlast2, testfirst2

The code I wrote is,

maker = "";             
for(var i=0; i < data.ObjAssociatedPartyRole_tab.length; i++)               
{                   
  if (data.ObjAssociatedPartyLocal_tab !== null && 
  data.ObjAssociatedPartyLocal_tab !== ''){                     
    for(var j=0; j < data.ObjAssociatedPartyRole_tab.length; j++){                              
    maker += data.ObjAssociatedPartyRole_tab[i] + " : " + data.ObjAssociatedPartyLocal_tab[j] + "\n";                       
    }                           
  }                 
}
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