I am trying to create a super simple JavaScript templating solution. I want to use the JavaScript replace method to find all instances of curly braces in a template and replace them with their appropriate data.
For instance, if my template was: <p>My name is {{name}}. I am {{age}}.</p>
I would want the result: <p>My name is Olly. I am 19.</p>
Here's my code so far: http://jsfiddle.net/2RkAG/
I'm trying to make it automatically replace each piece of data, so I don't have to explicitly tell the JavaScript what to replace. However, this is where I am having problems.