JavaScript: string.replace() does not work, what is the problem?
<p>I've tried everything, but my code doesn't work. I don't know why.</p>

<p>Here is it:  </p>

<pre><code>var table = $("#cpTableBody").html();  
$("#cpTableBody").html('');

var tmpContent = "";
for (i=0; i&lt;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);
</code></pre>
