I've tried everything, but my code doesn't work. I don't know why.
Here is it:
var table = $("#cpTableBody").html();
$("#cpTableBody").html('');
var tmpContent = "";
for (i=0; i<cpData.length; i++) {
var tmpTable = table;
tmpTable.replace(/{firstname}/g, cpData[i].contact_person.firstname);
tmpTable.replace(/{lastname}/g, cpData[i].contact_person.lastname);
tmpContent += tmpTable;
}
$("#cpTableBody").html(tmpContent);
tablenever changes sovar tmpTable = table;in the loop seems to be pointless reassignment, and that further implies that{firstname}and{lastname}are going to be replaced in the first loop iteration and all other iterations will do nothing. Am I missing something?