Js Var To Get Php Value In Wp
I was reading all similar questions and answers around, but none seem to work for me. i have this:
Solution 1:
The issue is that you have quotes around your echo statement, you need to have them around your variable AFTER it has been output to function within the script, like so:
<script>varMyCity = <?phpecho'"Cityville"';?>;
</script>
Solution 2:
use like this
<script>varMyCity = <?phpecho'Cityville';?>;
</script>
Post a Comment for "Js Var To Get Php Value In Wp"