There's a difference in the origin of your href between the initial
code that 'worked' and the first posted re-try that didn't.

In the first one - the working code, as was -

// 'this' must be referring to some element, say X
$('#' + this.rel) // select some other element, say Y
  .fadeOut('slow') // fade out Y
  .load( this.href  // load into Y using X.href ...
         , {targ: this.rel} // ...setting param targ as X.rel
         , function() { // 'this' refers to Y
        $(this).fadeIn('slow'); // fade in Y
});

In the second one - the first posted -

$('#' + what) // select some element, say Y
  .fadeOut( 'slow' // fade out Y
     , function() { // 'this' refers to Y
        $(this)
           .load( this.href // load into Y using Y.href...
                  , {targ: what} // ...setting param targ as what
                  , function() { // 'this' refers to Y
        $(this).fadeIn('slow'); // fade in Y
      });
  });

It's logical to assume that X and Y are different elements otherwise
there is no point in the initial select [ $('#'+this.rel) ]. So, one
uses X.href and the other uses Y.href.

Apart from that, I can see no reason why the callback version should
not work ( except that I would unquote targ, ie {targ:what}, not
{'targ':what} )

On Dec 7, 8:51 pm, Dave Methvin <[EMAIL PROTECTED]> wrote:
> Your original code looked okay to me....
>
> BTW, this is the docs on ajax load, the other is the load event
> binding.
>
> http://docs.jquery.com/Ajax/load
>
> What error are you getting? The diff with the working version seems to
> point to a problem with the fadeOut callback...

Reply via email to