Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8494635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:21:16+00:00 2026-06-10T23:21:16+00:00

I have a site that has particular alphanumeric ID for every song, say like

  • 0

I have a site that has particular alphanumeric ID for every song, say like 57bfab618de4191 In the jQuery player the MP3 song has to be assigned via link.

The jplayer function is this:

     $(document).ready(function (){
   function playAudio(val) {newVal=val}    

        $("#jquery_jplayer_1").jPlayer({
            ready: function (event) {
                $(this).jPlayer("setMedia", {
    mp3:"http://website.com/dlb.php?file="+newVal                       });
            },
            swfPath: "js",
            supplied: "mp3",
            wmode: "window"
        });
    });

I want to play different song present in the list for user so I passed a ID of song via button onClick like this

  onClick="playAudio(<?php echo "'".$songid. "'"; ?>)"  

Where song ID is the iD of the song specified in database, like 57bfab618de4191

This way I can pass the value, but I am not able to transfer the parameter of playAudio function to the document.ready function.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T23:21:17+00:00Added an answer on June 10, 2026 at 11:21 pm
    var val = 'whateveer'
    
    function playAudio(nval) {
        var val = nval;
        $("#jquery_jplayer_1").jPlayer({
            ready: function(event) {
                $(this).jPlayer("setMedia", {
                    mp3: "http://website.com/dlb.php?file=" + val
                });
            },
            swfPath: "js",
            supplied: "mp3",
            wmode: "window"
        });
    }
    

    no need for $(document).ready


    if you need to change songs:

    var val = '12345'; // your first song
    $(document).ready(function() {
        $("#jquery_jplayer_1").jPlayer({
            ready: function(event) {
                $(this).jPlayer("setMedia", {
                    mp3: "http://website.com/dlb.php?file=" + val
                });
            },
            swfPath: "js",
            supplied: "mp3",
            wmode: "window"
        });
    });
    
    function playAudio(nval) {
        var val = nval;
        $("#jquery_jplayer_1").jPlayer({
            "setMedia", {
                mp3: "http://website.com/dlb.php?file=" + val
            }
        });
        // --- OR ---
        $("#jquery_jplayer_1").changeAndPlay("http://website.com/dlb.php?file=" + val);
    }
    

    More info:

    • Changing songs on jPlayer by clicking a link, hosted on Amazon S3
    • http://www.jplayer.org/0.2.1/developer-guide/#jPlayer-change
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently I have a site where it has a header that looks something like
Lets say I have a site that has a Layout with navigation. This navigation
I have a site that has an Rss feed, and this feed is consumed
I have a site that has a /sites/default/files/ directory where user content is typically
I have a site that has 2 DIV tags, one floats left the other
Information: I have a site that has a design on index.php, and then you
I have a paging control on my site that has it's container element set
I have a two column site layout that has the content of the left
I have a Rails 2.1.2 site that only has html templates e.g. jobs.html.erb, so
I have a very complicated site built on CSS3 that has html elements 3d-transformed,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.