I have a situation where I need to insert a block of code when somebody clicks something - I don't really need to do any server side processing for this so doing it via JS would be ideal.
In saying that I'm not sure what the best way to handle templates in JS would be - that is having a block of code which you want to make replacements in with variables.
Yes I could include the actual HTML in the same JS file, but that would be rather messy and I want to avoid that.
What is generally the best way to do this?