jPlayer + custom Views ajax

$=jQuery;
$(document).ready(function(){
  var selector = $("#block-views-jplaylist-block a");
  selector.click(function (event){
    event.preventDefault();
 $.ajax({
      url: "/views/ajax",
      type: "POST",
      dataType:"json",
      data: {
        "js":0,
        "view_name":"ontopjplayer",
        "view_display_id":"block",
        "view_args": $(this).attr('rel')
      },
      success: function(view) {
        $(".view-ontopjplayer").replaceWith(view[1].data);
           Drupal.settings.jPlayer = view[0].settings.jPlayer;
           Drupal.settings.jplayerInstances = view[0].settings.jplayerInstances;
           Drupal.attachBehaviors(document);
    }
    });
  });
}); 
Help Share this Article