Rick - the load method is asynchronous, so you have to get the html from
#favoritesHold in a callback from the load method.  Otherwise, the
subsequent code after the load method is running before the html is returned
from the server.

-- Josh

-----Original Message-----
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Rick Faircloth
Sent: Wednesday, August 19, 2009 3:02 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: Is this sytax legitimate?


Hmmm...tried that and couldn't get it to work...something strange is going
on.

Tried this sequence, too:

var favoritesHTML = '../components/userFavoritesHTML.cfm?' + new
Date().getTime();

$('#noFavorites:visible').hide();
        

$('#favoritesHold').load(favoritesHTML);

var newHTML = $('#favoritesHold').html();

$('.menu1').append(newHTML);

I can see the HTML on the screen in the #favoritesHold in the second line of
code above,
but nothing gets appended to .menu1.

Any other suggestions?

Rick



-----Original Message-----
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of ak732
Sent: Wednesday, August 19, 2009 4:22 PM
To: jQuery (English)
Subject: [jQuery] Re: Is this sytax legitimate?


Actually,  this would be better I think:

$(".menu1").append($("<div/>").load(favoritesHTML).html());

The idea being to consruct a temp placeholder for your loaded html
that goes away after.

On Aug 19, 4:18 pm, ak732 <ask...@gmail.com> wrote:
> The syntax looks okay.
>
> Are you using Firebug to verify that #favorites (which appears to be a
> mysterious <li> somewhere) is actually being loaded as you expect?
> Does it actually contain the <li> tags you show above?
>
> Also, you might want to eliminate #favorites altogether by taking a
> page from jQuery's load implmentation like this:
>
> $("<div/>").load(favoritesHTML).html().appendTo(".menu1");

Reply via email to