Closed (works as designed)
Project:
jQuery AJAX Load
Version:
7.x-1.0
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
29 Dec 2013 at 21:03 UTC
Updated:
11 Apr 2016 at 10:47 UTC
Jump to comment: Most recent
Comments
Comment #1
nicolas bouteille commentedjquery_ajax_load.js line 66 $(el).addClass( "jquery_ajax_load_open" );
class jquery_ajax_load_open is added inside the callback function of the ajax call
$(target).load('/jquery_ajax_load/get' + url, function() {
In my case, the ajax call generated an error because of ShareThis. But the rest of the page was successfully displayed so the class jquery_ajax_load_open should have been added anyway.
In the end I think it would be better to add the open class after the ajax call, not inside callback function...
Comment #2
hatuhay commentedThe reason why the class is added inside the load function is because it is the only way to assure that tha call was succesfull.
Otherwise you could end up adding classes when the call returned and error.
Comment #3
nicolas bouteille commentedOk but what is wrong with adding classes when the call returns an error ? I mean in my case this is a small error regarding ShareThis that makes the call return an error. But the rest of the page is loaded and displayed. So I would be better off with a class that is being added anyway, wether the call returns successfully or not.
Why would you not want the 'open' class to be added if the call returns an error ? I mean, if the call returns an error because the serveur is not responding or the url is not good, then we've got a bigger problem than just a class that is being added when it shouldn't... since nothing is displayed at all...
Comment #4
hatuhay commentedI mean "if the call was succesfull, then add the class".
So the class is added inside the callback function.
What you are saying is that the content is loaded, but the call was unsuccessful, so the class "open" was not added eventhough it is actually "open".
Comment #5
nicolas bouteille commentedyes exactly, that's what I say, and that's what you say... what you don't say is why you say so :)
why do you need the 'open' class added only if the call was successful ?
Comment #6
hatuhay commentedBecause I never expected the callback content to be loaded even if if the call was not sucessful.
Comment #7
nicolas bouteille commentedI did not ask you 'why did you do that in the first place' ? That I know.
But it looks like that even now that you now that the content can be loaded even if the call was not successful you still think it's better to leave it that way. Am I right ? If yes then I want to know 'why you NEED it to stay that way' ? But maybe you are planning to move the class outside as I suggested and I just did not understand that...
Comment #8
hatuhay commentedBelieve me when I say that I appreciate your comments.
Changes are on today's DEV version, will test it for a few days before issuing a new release.
On your point, I was reviewing the hole error handling.
On the new version, page handling related errors will be shown on target div, only first time you try to load it, I mean for example 403 or 404.
I have to say that in this cases the after callback function works so, I have the chance to handle the error.
Since I cannot reproduce the case you mention, I do not know the effect on this case.
But I have to assume that the after callback function is not call, so error handling will not be posible.
Toggle open class is added outside callback function, so first time toggle should be OK.
Please let a time for Drupal to update DEV version, test it and let me know.
Comment #9
nicolas bouteille commentedSorry I won't be allowed to use the dev version on te site I am working right now which is where I have this error so a sandbox site wouldn't help. I don't know what to do... lack of time also... I'll see what I can do.
Comment #10
hatuhay commentedComment #11
abaier commentedAny updates on this behavior?
I am trying to get a view (many teasers in a grid) working with this module where the teasers load the node-contents into the header of the view. Everything works fine (esp. after patching the multilingual url-pattern), but unfortunately the class .jquery_ajax_load_open will be added to all clicked links. I would expect it to be removed from the previously clicked links so that I could style the currently activated and viewed node.
Any ideas of fixing this in the module to avoid jquery fixes?
Thanks in advance,
Anton
Comment #12
abaier commentedAdditional information: My previous comment describes the situation with toggle and animations disabled.
If toggle is activated the class is toggled only by clicking the activated and loaded teaser (node) again. When an other teaser is clicked, the first node will toggle content and class, but will not open up the next node instantly. For this another click on the teaser is required.