I am trying to use views_embed_view in a menu callback, so I can load the entire view block with AJAX. Code:

********

function cmi_core_menu() {
$items['jax'] = array(
'title' => 'TITLE HERE',
'page callback' => 'cmi_core_footer_ajax',
'access callback' => TRUE
);
return $items;
}

function cmi_core_footer_ajax(){
$view = views_get_view('why_school_footer');
$display = $view->execute_display('block_1');
$output = print $display['content'];
return $output;
}

*******

This gives me all my markup at /jax, but does not load the necessary js. Expected, I suppose, since the header has already been rendered and is not being modified by my AJAX. The question is - how do I include the appropriate JS (with it's view-specific settings) and initialize my slideshow?

I have done some looking already, and all of the references I've found to this problem involve embedding the view in a .tpl.php file, which won't work in my situation.

Thank you!

Comments

butteryak’s picture

Issue summary: View changes

so did you solve this, I have the same problem...

NickDickinsonWilde’s picture

Status: Active » Closed (outdated)

With current views this should work. If it isn't, re-open and I'll look into it.