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";
}
}
}