I need to insert a value from php code into the page for use in javascript.
<script type="text/javascript">
window.jQuery || document.write("<script src='assets/js/jquery1x.min.js'>"+"<"+"/script>");
</script>
and this is PHP:
<?php echo WEB_ROOT; ?>
i need to insert here:
<?php echo WEB_ROOT; ?>assets/js/jquery1x.min.js
How can i do?
Thanks!
Just simply echo it
<script type="text/javascript">
window.jQuery || document.write("<script src='<?php echo WEB_ROOT; ?>assets/js/jquery1x.min.js'>"+"<"+"/script>");
</script>
And even if your code is separate file, you can still rename it to .php
and include in html
<script src="file.php"></script>