Reputation: 891
So basically i have a js file which looks like:
var player = $("#zen .player");
player.jPlayer({
ready: function () {
$(this).jPlayer("setMedia", {
mp3: ""
});
},
swfPath: "",
supplied: "mp3"
});
And i want to be able to set the mp3 value of the js from a php value (e.g. $h->post->vars['audio']
.
So something like mp3: $h->post->vars['audio']
The mp3 value must remain between the double-quotes for some reason in order to work.
I am using Zen Audio Player.
Thanks in advance!
Upvotes: 1
Views: 1354
Reputation: 324750
More generally, to put a PHP value in JavaScript:
var something = <?php echo json_encode($php_var); ?>;
Upvotes: 2