Cache the compiled js template and replace the url.
JavaScript encode the url we generate.
Properly remove quotes.
Updated the comment