I want to be able to echo a PHP link inside a JavaScript string, i.e. <?php echo SITE_URL ?>
. How can I do this with the code below?
<script type="text/javascript">
$.backstretch("http://www.example.com/bg.jpg");
</script>
I want to be able to echo a PHP link inside a JavaScript string, i.e. <?php echo SITE_URL ?>
. How can I do this with the code below?
<script type="text/javascript">
$.backstretch("http://www.example.com/bg.jpg");
</script>
you can do
<script>
var test= '<?php echo SITE_URL; ?>';// and use it as you please
</script>