The music player picks some songs and plays in the rails

In my rails 4 application I have a jplayer to play music files, it works fine and I need to add some songs from the playlist using a checkbox and play option. Its harder to set up the default jplayer playlist so that I create a separate playlist and code

  <%= form_tag album_path , method: :get,  id: "sel" do  %>
     <%= submit_tag "play", name: nil, :class => "btn btn-success " %>
     <%= link_to "Play All", album_path , :class => "btn btn-success "%>
      <%  @album.audios.each do |audio| %>
        <%= check_box_tag "audio_ids[]",audio.id ,nil,class: "song"%></td>
        <%= link_to audio.name, album_path(id: @album.id, audio_ids: audio) %>
        <%= audio.artist %>
      <% end %>
 <% end %>

      

and his works are beautiful too. Whenever I select some checkboxes the corresponding IDs are skipped and I will display the json according to that and I will create a playlist and this is the code to generate the code in jplayer

$.ajax({ 
    type: 'GET',
    url:window.location ,
    dataType: "json",
    success: function(json){
       $.each(json,function(data){ 
        myPlaylist.add({title:$(this).attr("name"), artist:$(this).attr("artist"), m4a:$(this).attr("audio_url")});
         });
          }
       });

      

Now I need the checkboxes to keep their status (checked or unchecked) after refreshing the page until the user changes the status. How do I do this? ...... Can I use sessions? (If there is any way to have the jplayer default playlist checkbox, please tell me that too) ....

+3
javascript jquery ruby ruby-on-rails jplayer


source to share


No one has answered this question yet

See similar questions:

2
Checkboxes should be checked after page refresh.

or similar:

642
Select the <a> which href ends with some line
151
Rails select helper - selected default, how?
five
Jplayer playlist - by clicking the "Play" button, you need to add a dynamic composition and play the song in the player and switch the play button to pause
4
Download and play a song
2
Playing a song in jPlayer that was loaded via Paperclip - Ruby on Rails - jQuery - jPlayer
2
get the duration of the song before the player loads
1
Onclick plays the song - jPlayer
0
Rubies on the rails?
0
SCM music player for single song playback
-2
JPlayer playlist not switching from ajax request



All Articles
Loading...
X
Show
Funny
Dev
Pics