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 7158333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:02:52+00:00 2026-05-28T13:02:52+00:00

I am making a Music player for my web app. After user upload some

  • 0

I am making a Music player for my web app. After user upload some mp3 file to the server the playlist will be generate automatically via AJAX call to the database. I found a good simple jquery plugin music player here

It works perfect if I include the file reference manually in my HTML like this one :

<div id="playlist">
                <div href="./media/Maria (Extended remix) - Blondie .mp3" style="width: 400px;" class="item">
            <div>
                <div class="fr duration">02:06</div>
                <div class="btn play"></div>
                <div class="title"><b>Blondie</b> - Maria</div>
            </div>
            <div class="player inactive"></div>
        </div>

But it’s not the solution for me because there’s hundred .mp3 files in the server. So, i decided to generate the file list via ajax call and put it into the #playlist with jquery. Like this one :

function refresh_song_list()
{
    $.ajax({
        type: 'GET',
        url: 'profile/get_song',
        dataType: 'json',
        success: function(data) {
            var str='';
            for(i=0;i<data.length;i++)
            {
                str = str + ('<div href="'+ data[i][song_url]+'" style="width: 400px;" class="item"><div><div class="fr duration">02:06</div><div class="btn play"></div><div class="title"><b>'+ data[i]['artist']+'</b> '+ data[i]['song_title'] +'</div></div><div class="player inactive"></div></div>');   
            }
            $('#playlist').html(str); //this line add the songlist(playlist) into the #playlist div
        }
    }); 
}

Then, to make the playlist playable , I put this code (according to the plugin instruction) in the jquery document ready scope:

$("#playlist").playlist(
                {
                    playerurl: "js/jquery/jquery-plugins/drplayer/swf/drplayer.swf"
                }
            );   

The problem is, The playlist load successfully with play button on each item, but it won’t play the song. Is there any mistake in my code? please help me guys. Thanks

  • 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-05-28T13:02:53+00:00Added an answer on May 28, 2026 at 1:02 pm

    My guess is that because you are populating the playlist with ajax, the .playlist() initializer does not see those elements because they do not exist yet (at the document ready scope as you state).

    Instead, call .playlist() in your ajax callback:

           success: function(data) {
                var str='';
                for(i=0;i<data.length;i++)
                {
                    str = str + ('<div href="'+ data[i][song_url]+'" style="width: 400px;" class="item"><div><div class="fr duration">02:06</div><div class="btn play"></div><div class="title"><b>'+ data[i]['artist']+'</b> '+ data[i]['song_title'] +'</div></div><div class="player inactive"></div></div>');   
                }
                $('#playlist').html(str); //this line add the songlist(playlist) into the #playlist div
    
                $("#playlist").playlist(
                    {
                        playerurl: "js/jquery/jquery-plugins/drplayer/swf/drplayer.swf"
                    }
                );
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making a music player in PyQt4, and I am using Phonon to
I'm making a game. Now if my player goes to another level the music
Currently I am making a mini music player / organizer for myself. However, when
I am making a simple music playing online app. I would like to make
I'm making a music player. When you press play, it loads a notification into
I'm in the process of making a music app and I'm currently working on
long time reader, first time asker... I am making a music app which uses
I'm thinking of improving my programming skills by making a music player to sync
I am making a quiz app and i have set different background music in
I am making a music player and I have a list with all the

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.