I've re-enabled 1.4, you can see, it doesn't work as one would
expect.

Zack

On Jan 12, 10:03 pm, Dave Methvin <dave.meth...@gmail.com> wrote:
> A test case would definitely help. It seems like the code should work
> as-is, but it's probably not quite doing what you expected.
>
>         $("a[title!='']").click(function() {
>             ...
>         }).ajaxStart(function() {
>                 $("#loader").show();
>         }).ajaxComplete(function() {
>                 $("#loader").hide();
>         });
>
> That puts an ajaxStart and ajaxComplete handler on every a element
> selected. When ajaxStart fires, it will run the function for *all* the
> links, executing the .show() several times. The same goes for
> ajaxComplete. The new docs do a much better job of explaining 
> this:http://api.jquery.com/ajaxComplete/
>
> Still, it seems like that code should work as written and we should
> figure out why it doesn't. I tried creating a simple test case with
> just two links and the two ajax handlers like you had there, but I
> can't reproduce a problem with it. Can you whittle down the page into
> a smaller test case that still breaks?
>
> As for a rewrite, it would be better to write this code with the
> #loader element as the only element that binds to the ajax events,
> since it's the only element that cares about the current state of
> ajaxing. Also, in that case you probably want ajaxStop and not
> ajaxComplete. So the final code would look something like:
>
>         $("a[title!='']").click(function() {
>             ...
>         });
>         $("#loader")
>          .ajaxStart(function() {
>                 $(this).show();
>           })
>          .ajaxStop(function() {
>                 $(this).hide();
>           });
-- 
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-...@googlegroups.com.
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en.


Reply via email to