Hi,
What's the best practice for using ASP.NET expressions inside an external Javascript file?
I'm using the ASP.NET MVC framework currently and need to do something similar to the following from within an external JS reference:
jQuery(document).ready (function () {
jQuery ("#element<%= Model.IdFromAThing %>").click (... blah ...
});
I could move this into the View, granted, but I'd like to keep it separate.
P.S.
One of the advantages of doing this is I can re-use the same JS file in many places, I don't really want to repeat initialisation logic in each view (considering it'll be identical).