javascript - How can I pass a variable in the path -


i have script , want play song has name 'pr_id', how can write in path? thanks!

     $(document).ready(function(){             var pr_id = document.getelementbyid('id')             $("#jquery_jplayer_1").jplayer({                 ready: function (){                     $(this).jplayer("setmedia", {                          mp3:"/sounds/[pr_id].mp3"                         });                         },                        swfpath: "js",                         supplied: "mp3",                        wmode: "window"                     });                 }); 

like so:

$(document).ready( function() {     var pr_id = document.getelementbyid('id');      $("#jquery_jplayer_1").jplayer({         ready: function() {             $(this).jplayer("setmedia", {                  mp3:"/sounds/" + pr_id + ".mp3"             });         },         swfpath: "js",          supplied: "mp3",         wmode: "window"     }); }); 

concatenate string variable :), unfortunately, unlike other languages it's not easy include variables in string, , have split string bit concatenation.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -