I have strange issue. When I click to "load more" first time it works fine and as expected. But when I click it again it goes to www.website/"view-page"?page=2. So page reloads as common pager. AJAX turned on. Firebug shows no errors.

Than you! Hope you'll help me


rivali’s picture

I have the same issue. But looking at your example page it seems to be working fine for you now. Did you fix it Paradoxetion? If so, would you mind sharing the solution? Thanks

lightsurge’s picture

I'm having this issue as well.

Edit: sorry, no I'm not, in my case the waypoint event isn't firing except on the first time.

Paradoxetion’s picture

For you it is ok in my example? So you can click to "load more" more then 1 time and AJAX will work?

Hm, do you see ads banner at the top of my example page? My idea is there is some code on your and my side which turns off "views load more" AJAX after first run. Do you have some modules which use jQuery and/or AJAX except of Views?
Thank you!

rivali’s picture

Yes, for me you site seem to be working fine. AJAX loads new content each time and no page reload. I'm in Safari on OS X.

For me, it loads with AJAX every second time. So first time it works, then reloads, then works, then reloads... Each time showing new content though. No other AJAX enabled on page (but jQuery).

rivali’s picture

Just noticed it works fine in the latest DEV release.

jide’s picture

Priority: Normal » Major

I have the same issue. And did some investigation.

The problem lies in Drupal.settings.views.ajaxViews.
console.log() shows that before "load more" has been clicked, the settings.views.ajaxViews object is like this :

views_dom_id:7cea2ab6d2372e7c628825a05ab58034: Object
  pager_element: "3"
  view_args: "632"
  view_base_path: "views/group/%"
  view_display_id: "page"
  view_dom_id: "7cea2ab6d2372e7c628825a05ab58034"
  view_name: "coopnet_wall_group"
  view_path: "node/120744"
  __proto__: Object

After it has been clicked :

views_dom_id:7cea2ab6d2372e7c628825a05ab58034: Object
  pager_element: Array[2]
  view_args: Array[2]
  view_base_path: Array[2]
  view_display_id: Array[2]
  view_dom_id: Array[2]
  view_name: Array[2]
  view_path: Array[2]
  __proto__: Object

drupal_add_js() merges settings when their key is the same, so calling drupal_add_js($settings, 'setting'); twice with the same key merges the settings. But I suspect this may be in the AJAX process that this merge occurs.

Still trying to find a workaround.

Funnily, this issue seems to be recent for all of us, so it may be because of a change in views or in core.

Bumping to major since the module does not work as expected in this case.

jide’s picture

Ah and this happens with lastest -dev release, with views 7.x-3.5 with any theme.

jide’s picture

Error thrown is :
"Uncaught TypeError: Object coopnet_wall_group,coopnet_wall_group has no method 'replace'" (coopnet_wall_group being the name of the view).

jide’s picture

Status: Active » Needs review
1.25 KB

After digging and digging, I found how to make sure this never happens.
See comment in code for info.

Patch attached. Yay !

jide’s picture

After digging and digging, I found how to make sure this never happens.
See comment in code for info.

Patch attached. Yay !

jide’s picture

Sorry for the noise, but I believe there are 2 different issues here :

- The one I just fixed with my patch, A.K.A "There is an AJAX error after first paging that throws an error and break AJAX paging on pages > 1 so I go to a paged URL with ?page=XXX"
- A second one, A.K.A "No AJAX error, but when I scroll down to the bottom of the page, second page is loaded, but then I scroll again, and second page is not automatically loaded, I have to click the "Load more" button myself etc.".

havran’s picture

I have same problem. This looks for me there is no attached click() event on Load more link after loading new items.

lightsurge’s picture

- The one I just fixed with my patch, A.K.A "There is an AJAX error after first paging that throws an error and break AJAX paging on pages > 1 so I go to a paged URL with ?page=XXX"

Yes I don't have this problem, no ajax error and everything works properly if I click the load more link.

- A second one, A.K.A "No AJAX error, but when I scroll down to the bottom of the page, second page is loaded, but then I scroll again, and second page is not automatically loaded, I have to click the "Load more" button myself etc.".

Yea.. I'm actually finding it only happens now if the waypoint event is triggered repeatedly (if I set views to list say just 1 item at a time), it fails to click the load more button after the first shot - possibly because it's deactivated while it's ajax-loading the next item. I should open a new issue for this, though.

havran’s picture

For me patch from http://drupal.org/node/1439778#comment-5928906 fix this.

-- edit

I try dev version now and this version fix all my problems.

ericduran’s picture

Status: Needs review » Postponed (maintainer needs more info)

This should not be an issue if you're using the dev version.

If someone could confirm this is a problem on the dev version then I'll re-open the issue. But as stated above this is fixed in the dev version.

aalireza’s picture

i using last dev version , have same problem.
i am using ajax load more just show once.

babruix’s picture

Just to confirm: I had same problem (with 7.x-1.1), then switched to views_load_more-7.x-1.x-dev and problem doesn`t appear anymore (fixed).
So if somebody still has this problem with DEV - he should describe better his workflow, or maybe check another AJAX modules that could break functionality.

Bogdan Balan’s picture

I installed 7.x-1.x-dev and that fixed it for me.

kirie’s picture

Yes - current 7.x-1.x-dev also fixes this for me!

ericduran’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)
Juryiel’s picture

Status: Closed (works as designed) » Active

I just installed the latest dev and I'm having this issue. Looks like there was an update to the dev in April, and the comments posting that the dev works are from March. Maybe this bug was re-introduced.

This is the error I'm getting in the script:

Uncaught TypeError: Object [object Array] has no method 'replace' ajax_view.js:60
Drupal.views.ajaxView ajax_view.js:60
(anonymous function) ajax_view.js:14
d.extend.each jquery.min.js:16
Drupal.behaviors.ViewsAjaxView.attach ajax_view.js:13
(anonymous function) drupal.js:76
d.extend.each jquery.min.js:16
Drupal.attachBehaviors drupal.js:74
Drupal.ajax.commands.viewsLoadMoreAppend views_load_more.js:74
Drupal.ajax.success ajax.js:400
ajax.options.success ajax.js:164
f.resolveWith jquery.min.js:16
v jquery.min.js:16
c jquery.min.js:1

Grayside’s picture

Priority: Major » Critical

-dev works for me. This seems like a critical bug and really needs a module release.

heshanlk’s picture

I don't see any erros and dev didn't work for me. I'm using a panel and embed a view inside it. I have Ajax enabled too. It loads once then pager disappeared.

Grayside’s picture

Views also has checkboxes that allow you to suppress some of the extra markup it adds. Some of this, at least, was necessary for me.

Juryiel’s picture

Could you elaborate which markup suppression options are necessary to get it working? It would be appreciated.

heshanlk’s picture

Change the line 58 to


Fixed my issue.

xeraseth’s picture

To help with the count, switching to dev version fixed it for me.

Juryiel’s picture

None of these solutions posted so far have fixed it for me :( Tried them all.

dooug’s picture

The change from #26 worked for me on the latest 7.x-1.x-dev. Here is the patch:

diff --git a/views_load_more.js b/views_load_more.js
index d13a665..c9afefb 100644
--- a/views_load_more.js
+++ b/views_load_more.js
@@ -55,7 +55,7 @@
     // Add the new content to the page.
     wrapper.find('.pager a').remove();
-    wrapper.find('.pager').parent('.item-list').html(new_content.find('.pager'));
+    wrapper.find('.pager').html(new_content.find('.pager'));
     if (effect.showEffect != 'show') {
Leksat’s picture

Status: Active » Needs review
612 bytes

For me it also happens because omega theme doesn't wrap ul with div.item-list (see line 59).

Grayside’s picture

@#25: I had to *not* use the ability to suppress some of Views' extra markup. In other words, Views had to be allowed to clutter up the markup.

If you are overriding that markup in other ways, the checkbox won't help. In this case, it was in style settings.

rooby’s picture

The patch in #30 is the same as the one at #2000572: Pager Link not appended, which I closed as a duplicate of this seeing as more poeple are here.

Worth noting though that mrsimonelliott's patch in that issue was created before this one so they deserve some credit.

There is also an older issue though with the same fix done in a slightly different manner (and no patch file): #1644036: Pager disappears after AJAX reload.

One of them needs to be applied though.

Hydra’s picture

Status: Needs review » Reviewed & tested by the community

Patch works perfectly fine and fixes the omega issue as well, thanks for the good work! For me this is RTBC and needs to be commited.

Juryiel’s picture

Status: Reviewed & tested by the community » Active

As I said, I tried the fix in that patch and it did not fix my issue, so I'm opening it up again.

I tried both the default Bartik theme and a minorly customized theme based on the Bartik theme.

The view itself is rather simple too, e.g.

$view = new view();
$view->name = 'trending';
$view->description = '';
$view->tag = '';
$view->base_table = 'node';
$view->human_name = 'Trending';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'Trending Submissions';
$handler->display->display_options['use_ajax'] = TRUE;
$handler->display->display_options['hide_attachment_summary'] = TRUE;
$handler->display->display_options['use_more_always'] = TRUE;
$handler->display->display_options['link_display'] = 'page';
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'some';
$handler->display->display_options['pager']['options']['items_per_page'] = '100';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['style_options']['row_class_special'] = FALSE;
$handler->display->display_options['row_plugin'] = 'node';
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
/* Sort criterion: Content: Post date */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'node';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = '1';
$handler->display->display_options['filters']['status']['group'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: Content: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
  'article' => 'article',
  'review' => 'review',

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['defaults']['pager'] = FALSE;
$handler->display->display_options['pager']['type'] = 'load_more';
$handler->display->display_options['pager']['options']['items_per_page'] = '1';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['pager']['options']['id'] = '0';
$handler->display->display_options['pager']['options']['quantity'] = '';
$handler->display->display_options['pager']['options']['tags']['first'] = '';
$handler->display->display_options['pager']['options']['tags']['previous'] = '';
$handler->display->display_options['pager']['options']['tags']['next'] = '';
$handler->display->display_options['pager']['options']['tags']['last'] = '';
$handler->display->display_options['path'] = 'trending';

I imagine either some view setting is off (tested by turning off as many of the 'strip CSS' settings as I could with no luck), or some other module I have is interfering.

Hydra’s picture

Status: Active » Reviewed & tested by the community

@Juryiel: I imported your export in a clean installation with latest dev version of this module and the patch in #30 applyed, and it worked like expected. Theme was responsive bartik. Can you please try it again on a fresh setup and explain your steps if it doesn't work?

How ever, I don't belive that your issue is the same as this one. "Woks only once" was just not applying the behaviour right to the pager, so at page 2 ajax wasn't acting anymore. No error like you described in #21. I found a simular issue in the views queue #1848476: Uncaught TypeError: Object view_name, view_name has no method 'replace'. I believe it's like you saied, it has something to do with your local setup, but just guessing :)

For me this issue still is RTBC, no one else described the problem Juryiel mentioned and neither is it part of the issue description.

rooby’s picture

Status: Reviewed & tested by the community » Active


Based on the error you reported in #21, I can't really see how this module (and this issue) would be the cause of your problem.

You error seems to be that one of the views settings for your view has an object for the view_name setting, when it is expecting a string.

This is happening in the views module in views_ajax.js although I would expect is caused by some other module.

A workaround would be to disable ajax for your view, but that isn't fixing the underlying problem.

What views related modules do you have installed?
What if you try disabling them one by one and re-testing?

There is also a similar issue at #1848476: Uncaught TypeError: Object view_name, view_name has no method 'replace', but there is no answer there yet.

rooby’s picture

Status: Active » Reviewed & tested by the community

sorry, bad timing.

I was also a bit mixed up with a couple of different bugs when I posted that last comment so I'm just doing a quick bit of extra investigation now.

[edit] It still doesn't seem like your issue is caused by this module.

Juryiel’s picture

Just to be clear, my issue IS a 'works only once' issue. What happens is exactly as described in the issue, except in addition to that if I do "Inspect Element" with Chrome I also see that error reported. Everything else is exactly the same in terms of behavior.

In addition, the error I posted only shows up with my modified theme, not with the standard Bartik theme. With the standard Bartik theme I still get the same behavior (works only once), but no error message. I will see if I can try disabling all other views-related modules, but it still seems that this shouldn't be the case that other modules interfere with this. I'll post about it in a bit after I've been able to test which module is interfering, if any.

Also note, I only see the error when I inspect the page with Chrome, the Chrome inspection tools report it. It doesn't show up otherwise, so others may be having this error but not noticing it.

Juryiel’s picture

It appears the culprit in my case is the 'Views Distinct' module. Even though I'm not using it in this view, just having it enabled is causing the same behavior as other 'Works Only Once' issues. I started a new Issue here: Works Only Once when Views Distinct module is installed but if anyone more knowledgeable than I can help me with it I'd appreciate it :)

adriancotter’s picture

I am having the works only once issue as well (but with 7.x-1.1)

But shouldn't the code be
+ wrapper.find('.pager').html(new_content.find('.pager').html());

Otherwise your going to get your pager looking like the following

<ul class="pager">
<ul class="pager">

Which is what was happening for me. I had hope this would fix the issue for me, but it did not. Seems like it might potentially be related though...

rooby’s picture


You will find that currently the development version of the module is the most stable.
Also, the patch in #30 of this issue does exactly what you are saying.
Just apply that patch until the maintainer has committed the fix to the module.

adriancotter’s picture

Thanks @rooby

langelhc’s picture

Thnks, I hope that the maintainer commits the fix soon.

olofjohansson’s picture

Status: Reviewed & tested by the community » Needs review
657 bytes

The next button is now being added twice for me.

The problem is that the old Load More link was removed with wrapper.find('.pager a').remove();, but the link is then added with wrapper.find('.pager').html(new_content.find('.pager').html()); causing the link to get added to both the new .pager and the old .pager.

Solved this by removing the entire .pager element, not just the link.

Andre-B’s picture

#44 is not working, if you remove the pager completely you cant add the new html contents to it. which leads into the same problem again.

correct/ working one just needs to replace the contents of the pager. I am not sure why the removed the anchor element in the first place, but doing so causes no harm, if you think it's needed add it.

// Add the new content to the page.
//wrapper.find('.pager a').remove();
Chris Charlton’s picture

Several months back this issue was happening for me until I updated to the Dev release. It worked as expected after that.

UPDATE: The dev branch was not the fix, we added a patch and I do not know which one it was just yet but will report back when I get a moment to inspect.

mansspams’s picture

#45 does not work ether. See #1644036: Pager disappears after AJAX reload for working solution.

JordanMagnuson’s picture

Status: Needs review » Closed (duplicate)
JordanMagnuson’s picture

Issue summary: View changes

example website delete