So I think the best way for me to keep my code is to call a function with a dynamic name. For example, I might need to call “productTemplate”, “userTemplate”, “orderTemplate”, etc…
Is this possible with javascript/jquery? Also, is it a performance hit or not so much?
How about storing those functions under an object? You could probably call those function names dynamically by using
evalor accessing them withwindow[type + 'Template'], but the object implementation seems easier and cleaner.(Also, the jQuery Templates plugin created by Microsoft might help with what you’re particularly trying to do. It’s so good that it’s gonna be built right into jQuery 1.5, dontchaknow.)