Adriana Hernández Adriana Hernández - 1 year ago 244
Twig Question

document.write javascript function is not working

I'm trying to use the

javascript function to set an external
file in my template, but, I want to do this via
just like this:

document.write('<link href="{{ asset('bundles/activos/css/app-orange.css') }}" rel="stylesheet" >');

But it does not work. Why this
function is not working? Can I put that
code in there?

Or what is the best way to pass a
route with
to a
javascript function?

Sorry if my english is not good. I hope you understand. Thanks.

Answer Source

Finally I realize the answer. The problem is that I was using the document.write() function inside of $(document).ready() function. My mistake was not to post the entire code here so you could see. I didn't know until now that I could not use document.write() function inside of the $(document).ready() function. Anyway, I want to thank you all for the comments and answers!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download