I have a view with a custom filters form, which is submitted via AJAX. In the AJAX callback function, I am setting some arguments to the view and render it manually:

$view = views_get_view('products_gallery');
$commands[] = ajax_command_replace('.view-products-gallery', $view->render());

The results come back OK, but the load more button does not work and points to system/ajax?page=1.

How can I fix the load more button so that it points to the current page and it loads the next results?

  • Have you tried setting the active path before you build your view? ex: menu_set_active_item("node/$nid") – thumbson Feb 10 '15 at 15:14
  • 1
    Are you using Views load more? drupal.org/project/views_load_more – Fons Vandamme Feb 10 '15 at 15:38
  • @thumbson That seems to make the button point to the right url, but now the problem is it's not using AJAX. Yes, f0ns, I am using the views_load_more module. – Marian Feb 11 '15 at 7:33
  • You might also try doing a form alter to change the action of the filter form – thumbson Feb 11 '15 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.