i am trying to implement a very simple find and replace template engine.
I don’t want to use an off the shelf script as i want to be as lean as possible.
i have some json that has values in it that i want to use to replace the tags.
so for example in the json this.whatever would replace {{this.whatever}} in the template.
i want to put a javascript template in script tags with an id to reference it.
i assume i would do an ajax request for the json which i can then loop through.
Then for each value look for it in the template and if it matches replace it.
would this be economical?
would i use regex to look for the braces or is there a better way?