I need to set JavaScript variable by php variable with out ajax. I try following code:
<script type="text/javascript">
var url = <?php echo($url); ?>;
</script>
but it will make problem,How can I do it?
I need to set JavaScript variable by php variable with out ajax. I try following code:
<script type="text/javascript">
var url = <?php echo($url); ?>;
</script>
but it will make problem,How can I do it?
Url is a string, so put it within quotes:
var url = '<?php echo($url); ?>';