The problem is the use of 'this' in the inner function. In that code it no
longer means what you want it to mean. Try this (pun intended) instead:

$('a[href^=logmar]').queue(function(){
        var $this = $(this);
        var args = $this.attr("href").split('?')[1];
        if(args.charAt(0) == "l")
        {
                var lm = args.substring(2, args.length);
                $.get("templates/templates.php", {'action': 'lm2sn', 'l' :
lm },
                function(response){
                        if(response.length > 0)
                        {
                                $this.tooltip({
                                        bodyHandler: function() {
                                                return response;
                                        },
                                        showURL: false
                                });
                        }
                });
        }
});

I don't know if there are any other remaining errors, but that will be one
more down.

-Mike

> From: rhodopsin
> 
> After getting a good nights sleep, and doing more research, 
> it seems the problem is not scope-related, but ajax-related. 
> The advice I have read suggests setting return values from 
> within the ajax callback function, because of the 
> asynchronous completion of the ajax function.
> So, I have attempted to apply the tooltip functions within 
> the ajax callback, but without success. The ajax is returning 
> it's values, but the tooltip is not being applied. Any advice 
> welcome. Thanks!
> 
> 
> $('a[href^=logmar]').queue(function(){
>       var args = $(this).attr("href").split('?')[1];
>       if(args.charAt(0) == "l")
>       {
>               var lm = args.substring(2, args.length);
>               $.get("templates/templates.php", {'action': 
> 'lm2sn', 'l' : lm },
>               function(response){
>                       if(response.length > 0)
>                       {
>                               $(this).tooltip({
>                                       bodyHandler: function() {
>                                               return response;
>                                       },
>                                       showURL: false
>                               });
>                       }
>               });
>       }
> });
> 

Reply via email to