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) ....
source to share
No one has answered this question yet
See similar questions:
or similar: