Ajax customization

5.x-1.x-dev, Code, feature request, normal, active

Yo, a while back I said I'd contribute back some ajax stuff I did with your module. So here's the basics:
Implementation of a new menu call to return json data:
<?php  $items[] = array(    'path' => 'myplay/artists-a-z',    'callback' => 'myplay_artists_alpha_listing',    'callback arguments' => $_GET['apage'],    'type' => MENU_CALLBACK,    'access' => TRUE,  );?>
corresponding menu callback function:
<?php// this is for the ajax call used on the frontpage to replicate what views_alphapager returnsfunction myplay_artists_alpha_listing() {  $args = func_get_args();  $view = views_get_view('artists_pager');  $output = views_build_view('page', $view, $args, FALSE);  $output = str_replace($view->alpha_pager_output, '', $output);  // might be a better way?  print $output;  exit;}?>
a little jquery:

$(document).ready(function(){
old = $('.apager .pager-list strong').html();
$('.apager .pager-list strong').wrap("");
$('.apager .pager-list a').click(function(){
target = $(this).html();
data = "apage=" + target;
old = $('.apager .pager-list strong').html();
$('.apager .pager-list strong').parent().html(old);
$(this).html("" + target + "");

read more