+ 5

Replace placeholders on page from within itself

I have a template page that has to be repopulated with values from data source. I wonder how to do it. Excerpt of the page html: ... <td colspan="2"> <strong>QUOTATION [ID]</strong><br> [Organisation_Details]</td> </tr> <tr> <td colspan="2"> <b>Client:</b><br> [Client]<br> ... So I have to replace [ID] and [Client] here, what is the best approach to do it? Thanks.

4th Mar 2019, 10:44 AM
Dejan Dozet
Dejan Dozet - avatar
2 odpowiedzi
+ 3
//hey de do can you explain it more, Maybe i can help you if i understand it.
4th Mar 2019, 10:11 PM
Sudarshan Rai
Sudarshan Rai - avatar
+ 3
Hello Shudarshan Rai 👑 thank you so much, but ive already found solution with a help of people on stackoverflow.com I will post that solution a little bit later here is my code for replacement of placeholders from the page itself: first: var data = $("body").html(); second: $.each(myRecords, function (key, val) { third: do many find replace + adding rows etc fourth: $("body").html(data); and that is it!
4th Mar 2019, 11:30 PM
Dejan Dozet
Dejan Dozet - avatar