Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
Not sure what I'm doing wrong here. Really simple scenario. I have 3x links to load 3x different html files into the target div, depending on which I click. After I load the page I can click any of the links and they work but nothing happens when I click again - the target div never changes after the first time.
<div class=\"landlordstenants-q\">
<ul>
<li><a class=\"ajax-link1\" href=\"sites/default/files/snippets/landlords/1.html\" rel=\".landlordstenants-a\">Link 1</a></li>
<li><a class=\"ajax-link1\" href=\"sites/default/files/snippets/landlords/2.html\" rel=\".landlordstenants-a\">Link 2</a></li>
<li><a class=\"ajax-link1\" href=\"sites/default/files/snippets/landlords/3.html\" rel=\".landlordstenants-a\">Link 3</a></li>
</ul>
</div>
<div class=\"landlordstenants-a\">
</div>
Please ignore the backslashes - it's because the code is inside a php statement.
Any help would be appreciated.
Thanks,
Comment | File | Size | Author |
---|---|---|---|
#11 | ajax_links_api-ajax_after_first_call-1923320-11.patch | 438 bytes | olofbokedal |
#5 | ajax-links-api-ajaxloading-fix.patch | 448 bytes | Rob C |
Comments
Comment #1
robriley78 CreditAttribution: robriley78 commentedJust to add - I tried a more complex scenario - different link class, different target div etc. Same problem. I can basically only make one Ajax call per page load.
Comment #2
robriley78 CreditAttribution: robriley78 commentedSort of solved. It doesn't like the fact that I'm trying to load my own HTML files - it works fine if I try to load other nodes. I can work with this but if anyone knows why it would be good to know/understand.
Great module though. Saved me some time :)
Comment #3
zwoelfgrad CreditAttribution: zwoelfgrad commentedI had the same issue when i override the html--ajax.tpl.php. I had to remove everything but "print $page" in the overridden tpl, because twice loaded scripts breaked some js in my single page application.
The problem was: the variable "ajaxLoading" was not reset after the ajax call. Putting a line at the end of the success function solved the problem for me.
Hope this helps.
Comment #4
serjas CreditAttribution: serjas commented@robriley78 please update on issue. So i can close this issue
Comment #5
Rob C CreditAttribution: Rob C commentedserjas i've found the same issue, that ajaxLoading = false; indeed need to be added, see this patch.
Comment #7
Rob C CreditAttribution: Rob C commented@zwoelfgrad
This could also be interesting for you https://drupal.org/node/1989532 I'm working on the same idea i guess.
Comment #8
serjas CreditAttribution: serjas commented@Rob C and zwoelfgrad,
If you remove $scripts from html-ajax.tpl.php, this issue may arise. But we cant have a general solution for this as you suggested. I tried removing $scripts and included context and ajaxLoading = false. Everything works fine but when i tried to ajaxify node/add/page with ahah image upload, it is not working! when i include $scripts, it works!
Comment #9
floorfi CreditAttribution: floorfi commentedOn my page a problem, similar to post #1, apears.
One page has different ajax-Links which should change a div-container on the same site. With click on one of these links, the content is correctly loaded to the container. Each following click on one of those links has no effect.
Im only loading drupal-nodes and further didn't changed anything at the templates.
Another problem is (maybe similar reasons?), that if I try to load a view with an accordion-layout to the container, the accordion script dosn't work.
Comment #10
andregriffin CreditAttribution: andregriffin commentedSimilar issues here. When I remove $scripts, my ajax div doesn't update with new content after the first load. When I include $scripts, the ajax load works fine, but then my Bootstap js menus don't work after ajax has been used.
My use case is ajax loading nodes into a modal window in a gallery style view. After closing the window, js dropdown menus don't work.
Edit: Patch in #5 seemed to solve my particular issue.
Edit2: Strangely, it only works if I have
<title><?php print $head_title; ?></title>
in the tpl, along with<?php print $page; ?>
Comment #11
olofbokedal CreditAttribution: olofbokedal commentedCreated patch for the latest dev.
All that's needed is to update the ajaxLoading variable after the call has been made. This is a boolean that indicates whether or not a call should be allowed.
Comment #12
serjas CreditAttribution: serjas commentedcommitted to latest devComment #13
serjas CreditAttribution: serjas commentedComment #14
andregriffin CreditAttribution: andregriffin commentedNew strange symptom and followup on #10. Now, dropdown menus work after every other ajax call. After the first call menus don't work, after the third they do, after the forth they don't, etc.
Comment #15
serjas CreditAttribution: serjas commented@andregriffin , have you tried latest 1.83?
Comment #16
andregriffin CreditAttribution: andregriffin commentedYes, that is my current version
Comment #17
mxwitkowski CreditAttribution: mxwitkowski commentedHi - I can report similar behavior. Using the latest version of the module v1.8.3 on a site with superfish drop menus (v7.x-1.9 from 4/27/13). The menus work fine when I first load my main page, once I interact with the page and load content into a div with the Ajaxify Drupal with JQuery Ajax module, my menus stop working. As soon as I navigate to and load another page on the site, the menus begin working again.
I have debugged for a bit and can't seem to locate the root cause - but it sure seems to be related. I also applied the patch from #11 and had no luck in resolving the issue. I also disabled the HTML5 page title option and removed the
echo $head_title;
in html--ajax.tpl.php; still no luck in getting the menus working after the initial load.I have tested in IE9, Firefox on the Mac and Chrome on the Mac -- all are showing the exact same behavior.
Comment #18
serjas CreditAttribution: serjas commentedAdded a admin settings to uncheck , if $scripts are removed. Updated in latest DEV. Please test and confirm
Comment #20
drwits CreditAttribution: drwits commentedSorry to open this thread again.
With scripts removed I only get one page load. I'm on the current dev release and I don't see an admin settings to uncheck if $scripts are removed.
Thanks.
Comment #21
serjas CreditAttribution: serjas commentedComment #22
peezy CreditAttribution: peezy commentedI was having the same issue with Ajax only loading on the first click, but here's how to fix it:
Comment #23
bocaj CreditAttribution: bocaj commentedI was having the exact same issue ... I followed @peezy's post in #22 at everything works as I expected! Thanks!
Comment #24
trackleft2 CreditAttribution: trackleft2 commentedon line 104 of ajax_links_api.js
Should be:
Reference
Comment #25
v8powerage CreditAttribution: v8powerage commentedHow about fix for 6.x?
Comment #26
PQ CreditAttribution: PQ at D. Agency commentedWe could really do with having a new stable release as the current one (7.x-1.83) is fundamentally broken due to
ajaxLoading = false;
being removed from ajaxAfter() in http://cgit.drupalcode.org/ajax_links_api/commit/?id=50d4cd48efc38ecb5b4....It's fixed in dev but until there's a 7.x-1.84 people will keep downloading the module and finding it broken.
Not sure what the situation is with the 6.x branch.
Comment #27
candelas CreditAttribution: candelas as a volunteer commentedYes, it would be nice a new release because you get the stable release, get problems, go to the issues and find this... and get the dev.
Thanks for the module and please, release a new version :)
Comment #29
garvin CreditAttribution: garvin commentedI was having a similar issue. I don't remember how I found the solution but in my case, I disabled textarea.js. I only remembered because after a core update, I discovered that my ajax forms would not work twice. I had forgotten that I had hacked it long ago. I found this solution in my old notes.
Find it here:
/misc/textarea.js
I did this to disable it:
/misc/textarea.js_disabled
Not very elegant but it worked. I'm sure there's a better method for solving the conflict.