[jQuery] Re: Is this sytax legitimate?

2009-08-19 Thread Dhruva Sagar
Glad it helped :), the sequence problem is something that has caught me off
guard quite a few times :).Hope you've worked it all out.

Thanks & Regards,
Dhruva Sagar.


Jonathan Swift
- "May you live every day of your life."

On Thu, Aug 20, 2009 at 6:44 AM, Dhruva Sagar wrote:

>  1 thing you need to make sure is that you must call this script of line
> (mentioned below in your mail), only after the '#favorites' has been
> updated, if the contents of the '#favorites' is changing dynamically then
> you will get weird results.
>   --
>
> Thanks & Regards,
> Dhruva Sagar .
>
> On Wed, 2009-08-19 at 13:41 -0400, Rick Faircloth wrote:
>
> $('.menu1').append($('#favorites').html());
>
>
>
> I get no errors in firebug when it’s run, but not code appended to .menu1,
> either…
>
>
>
>
>
>
> --
>
> *"Ninety percent of the politicians give the other ten percent a bad
> reputation."  - Henry Kissinger*
>
>
>
>
>


[jQuery] Re: Is this sytax legitimate?

2009-08-19 Thread Rick Faircloth

Finally!  That appears to have been the problem. (asynchronous method)
That explains why the content was appearing in some places of the dom,
but not in others and not in the alert.

This has been driving me crazy all day! :oP

Thanks, Josh!

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


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($("").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  wrote:
> The syntax looks okay.
>
> Are you using Firebug to verify that #favorites (which appears to be a
> mysterious  somewhere) is actually being loaded as you expect?
> Does it actually contain the  tags you show above?
>
> Also, you might want to eliminate #favorites altogether by taking a
> page from jQuery's load implmentation like this:
>
> $("").load(favoritesHTML).html().appendTo(".menu1");




[jQuery] Re: Is this sytax legitimate?

2009-08-19 Thread Rick Faircloth

Thanks!

The single quotes (one being reversed) was just a problem
with cut-and-paste into the email...font was changed.

Also, I have never understood (never really tried to...) why id's
can't be numbers or start with a number.  I started using numbers
before I knew it wasn't supposed to be that way...never had a problem
with them, however.

Why is that a bad thing?

Rick

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


A couple things that could help in debugging:
ID's are unique, and can't begin with a number. Check the quotes on
this line around #favorites:

var appendHTML = $(‘#favorites’).html();


On Aug 19, 12:48 pm, "Rick Faircloth" 
wrote:
> Hi, Dhruva, and thanks for the reply…
>
> Yes, there are a lot of variables that could affect the actual data, but I
just wanted to make sure, first,
>
> that it wasn’t a syntax problem.
>
> Since it’s not, I’ll go a little deeper.
>
> Basically, I’ve got backend code that generates html and outputs it to a
page.
>
> This is what ends up on the page (userFavoritesHTML.cfm):
>
> 
>
>      216 West Daryl Drive,
Hinesville
>
>      
>
>           
>
>      
>
> 
>
> 
>
>      51 Julie Lane, Midway
>
>      
>
>           
>
>      
>
> 
>
> Now I want to append that code to this element:  
>
> So, I thought I’d do this:
>
> var favoritesHTML = '../components/userFavoritesHTML.cfm?' + new
Date().getTime();
>
> $('#favorites').load(favoritesHTML);
>
> var appendHTML = $(‘#favorites’).html();
>
> $('.menu1').append(appendHTML);
>
> I need to get the html of #favorites since it’s an  in the above
,
>
> otherwise, I end up with li’s embedded within other li’s.
>
> When I run the code above, I get no errors from Firebug, but also no
content if
>
> I use alert(appendHTML), and no content is appended to .
>
> Thoughts or suggestions?
>
> Rick
>
> From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Dhruva Sagar
> Sent: Wednesday, August 19, 2009 1:54 PM
> To: jquery-en@googlegroups.com
> Subject: [jQuery] Re: Is this sytax legitimate?
>
> It depends on what $('#favorites').html() contains, have you checked that?
Are you sure the id is correct?
> The syntax by itself is absolutely correct, but what you should see in
your site is something that depends on a lot of things such as what the
 $('menu1') contains and what it should etc...try checking if the .html() is
returning the right data, then check if it is actually getting appended
using firebux, after you have reached that stage and confirmed the same
check if the styles are right...
>
> Thanks & Regards,
> Dhruva Sagar.
>
> Pablo Picasso
<http://www.brainyquote.com/quotes/authors/p/pablo_picasso.html>   -
"Computers are useless. They can only give you answers."
>
> On Wed, Aug 19, 2009 at 11:11 PM, Rick Faircloth
 wrote:
>
> $('.menu1').append($('#favorites').html());
>
> I get no errors in firebug when it’s run, but not code appended to .menu1,
either…
>
>
---
---
>
> "Ninety percent of the politicians give the other ten percent a bad
reputation."  - Henry Kissinger



[jQuery] Re: Is this sytax legitimate?

2009-08-19 Thread Rick Faircloth
 

Thanks, Dhruva…that turned out to be the problem.

Things were happening out of sequence.

 

With a callback, everything is now in order.

 

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

 $('#favoritesHold').load(favoritesHTML, function() {


 

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

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

 

 });

 

Thanks for your help!

 

Rick

 

From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf 
Of Dhruva Sagar
Sent: Wednesday, August 19, 2009 9:14 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: Is this sytax legitimate?

 

1 thing you need to make sure is that you must call this script of line 
(mentioned below in your mail), only after the '#favorites' has been updated, 
if the contents of the '#favorites' is changing dynamically then you will get 
weird results.


  _  


Thanks & Regards,
Dhruva Sagar <http://www.dhruvasagar.net/blog/> . 



On Wed, 2009-08-19 at 13:41 -0400, Rick Faircloth wrote: 

$('.menu1').append($('#favorites').html());

 

I get no errors in firebug when it’s run, but not code appended to .menu1, 
either…

 

 

--

"Ninety percent of the politicians give the other ten percent a bad 
reputation."  - Henry Kissinger

 



<>

[jQuery] Re: Is this sytax legitimate?

2009-08-19 Thread Dhruva Sagar
1 thing you need to make sure is that you must call this script of line
(mentioned below in your mail), only after the '#favorites' has been
updated, if the contents of the '#favorites' is changing dynamically
then you will get weird results.


Thanks & Regards,
Dhruva Sagar.


On Wed, 2009-08-19 at 13:41 -0400, Rick Faircloth wrote:
> $('.menu1').append($('#favorites').html());
> 
>  
> 
> I get no errors in firebug when it’s run, but not code appended
> to .menu1, either…
> 
>  
> 
>  
> 
> --
> 
> "Ninety percent of the politicians give the other ten percent a bad
> reputation."  - Henry Kissinger
> 
>  
> 
> 
<>

[jQuery] Re: Is this sytax legitimate?

2009-08-19 Thread mkmanning

A couple things that could help in debugging:
ID's are unique, and can't begin with a number. Check the quotes on
this line around #favorites:

var appendHTML = $(‘#favorites’).html();


On Aug 19, 12:48 pm, "Rick Faircloth" 
wrote:
> Hi, Dhruva, and thanks for the reply…
>
> Yes, there are a lot of variables that could affect the actual data, but I 
> just wanted to make sure, first,
>
> that it wasn’t a syntax problem.
>
> Since it’s not, I’ll go a little deeper.
>
> Basically, I’ve got backend code that generates html and outputs it to a page.
>
> This is what ends up on the page (userFavoritesHTML.cfm):
>
> 
>
>      216 West Daryl Drive, 
> Hinesville
>
>      
>
>           
>
>      
>
> 
>
> 
>
>      51 Julie Lane, Midway
>
>      
>
>           
>
>      
>
> 
>
> Now I want to append that code to this element:  
>
> So, I thought I’d do this:
>
> var favoritesHTML = '../components/userFavoritesHTML.cfm?' + new 
> Date().getTime();
>
> $('#favorites').load(favoritesHTML);
>
> var appendHTML = $(‘#favorites’).html();
>
> $('.menu1').append(appendHTML);
>
> I need to get the html of #favorites since it’s an  in the above 
> ,
>
> otherwise, I end up with li’s embedded within other li’s.
>
> When I run the code above, I get no errors from Firebug, but also no content 
> if
>
> I use alert(appendHTML), and no content is appended to  class=”menu1”>.
>
> Thoughts or suggestions?
>
> Rick
>
> From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On 
> Behalf Of Dhruva Sagar
> Sent: Wednesday, August 19, 2009 1:54 PM
> To: jquery-en@googlegroups.com
> Subject: [jQuery] Re: Is this sytax legitimate?
>
> It depends on what $('#favorites').html() contains, have you checked that? 
> Are you sure the id is correct?
> The syntax by itself is absolutely correct, but what you should see in your 
> site is something that depends on a lot of things such as what the  
> $('menu1') contains and what it should etc...try checking if the .html() is 
> returning the right data, then check if it is actually getting appended using 
> firebux, after you have reached that stage and confirmed the same check if 
> the styles are right...
>
> Thanks & Regards,
> Dhruva Sagar.
>
> Pablo Picasso 
> <http://www.brainyquote.com/quotes/authors/p/pablo_picasso.html>   - 
> "Computers are useless. They can only give you answers."
>
> On Wed, Aug 19, 2009 at 11:11 PM, Rick Faircloth  
> wrote:
>
> $('.menu1').append($('#favorites').html());
>
> I get no errors in firebug when it’s run, but not code appended to .menu1, 
> either…
>
> --- 
> ---
>
> "Ninety percent of the politicians give the other ten percent a bad 
> reputation."  - Henry Kissinger


[jQuery] Re: Is this sytax legitimate?

2009-08-19 Thread Josh Nathanson

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($("").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  wrote:
> The syntax looks okay.
>
> Are you using Firebug to verify that #favorites (which appears to be a
> mysterious  somewhere) is actually being loaded as you expect?
> Does it actually contain the  tags you show above?
>
> Also, you might want to eliminate #favorites altogether by taking a
> page from jQuery's load implmentation like this:
>
> $("").load(favoritesHTML).html().appendTo(".menu1");



[jQuery] Re: Is this sytax legitimate?

2009-08-19 Thread Rick Faircloth

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($("").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  wrote:
> The syntax looks okay.
>
> Are you using Firebug to verify that #favorites (which appears to be a
> mysterious  somewhere) is actually being loaded as you expect?
> Does it actually contain the  tags you show above?
>
> Also, you might want to eliminate #favorites altogether by taking a
> page from jQuery's load implmentation like this:
>
> $("").load(favoritesHTML).html().appendTo(".menu1");



[jQuery] Re: Is this sytax legitimate?

2009-08-19 Thread Rick Faircloth
Hi, Dhruva, and thanks for the reply…

 

Yes, there are a lot of variables that could affect the actual data, but I just 
wanted to make sure, first,

that it wasn’t a syntax problem.

 

Since it’s not, I’ll go a little deeper.

 

Basically, I’ve got backend code that generates html and outputs it to a page.

This is what ends up on the page (userFavoritesHTML.cfm):

 



 216 West Daryl Drive, 
Hinesville

 

  

 



   



 51 Julie Lane, Midway

 

  

 



 

 

Now I want to append that code to this element:  

So, I thought I’d do this:

 

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

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

var appendHTML = $(‘#favorites’).html();

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

 

I need to get the html of #favorites since it’s an  in the above 
,

otherwise, I end up with li’s embedded within other li’s.

 

When I run the code above, I get no errors from Firebug, but also no content if

I use alert(appendHTML), and no content is appended to .

 

Thoughts or suggestions?

 

Rick

 

 

 

 

From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf 
Of Dhruva Sagar
Sent: Wednesday, August 19, 2009 1:54 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: Is this sytax legitimate?

 

It depends on what $('#favorites').html() contains, have you checked that? Are 
you sure the id is correct?
The syntax by itself is absolutely correct, but what you should see in your 
site is something that depends on a lot of things such as what the  $('menu1') 
contains and what it should etc...try checking if the .html() is returning the 
right data, then check if it is actually getting appended using firebux, after 
you have reached that stage and confirmed the same check if the styles are 
right...

Thanks & Regards,
Dhruva Sagar.


Pablo Picasso <http://www.brainyquote.com/quotes/authors/p/pablo_picasso.html>  
 - "Computers are useless. They can only give you answers." 

On Wed, Aug 19, 2009 at 11:11 PM, Rick Faircloth  
wrote:

$('.menu1').append($('#favorites').html());

 

I get no errors in firebug when it’s run, but not code appended to .menu1, 
either…

 

 

--

"Ninety percent of the politicians give the other ten percent a bad 
reputation."  - Henry Kissinger

 

 



[jQuery] Re: Is this sytax legitimate?

2009-08-19 Thread ak732

Actually,  this would be better I think:

$(".menu1").append($("").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  wrote:
> The syntax looks okay.
>
> Are you using Firebug to verify that #favorites (which appears to be a
> mysterious  somewhere) is actually being loaded as you expect?
> Does it actually contain the  tags you show above?
>
> Also, you might want to eliminate #favorites altogether by taking a
> page from jQuery's load implmentation like this:
>
> $("").load(favoritesHTML).html().appendTo(".menu1");


[jQuery] Re: Is this sytax legitimate?

2009-08-19 Thread ak732

The syntax looks okay.

Are you using Firebug to verify that #favorites (which appears to be a
mysterious  somewhere) is actually being loaded as you expect?
Does it actually contain the  tags you show above?

Also, you might want to eliminate #favorites altogether by taking a
page from jQuery's load implmentation like this:

$("").load(favoritesHTML).html().appendTo(".menu1");


[jQuery] Re: Is this sytax legitimate?

2009-08-19 Thread Dhruva Sagar
It depends on what $('#favorites').html() contains, have you checked that?
Are you sure the id is correct?
The syntax by itself is absolutely correct, but what you should see in your
site is something that depends on a lot of things such as what the
$('menu1') contains and what it should etc...try checking if the .html() is
returning the right data, then check if it is actually getting appended
using firebux, after you have reached that stage and confirmed the same
check if the styles are right...

Thanks & Regards,
Dhruva Sagar.


Pablo Picasso
- "Computers are useless. They can only give you answers."

On Wed, Aug 19, 2009 at 11:11 PM, Rick Faircloth
wrote:

>  $('.menu1').append($('#favorites').html());
>
>
>
> I get no errors in firebug when it’s run, but not code appended to .menu1,
> either…
>
>
>
>
>
>
> --
>
> *"Ninety percent of the politicians give the other ten percent a bad
> reputation."  - Henry Kissinger*
>
>
>