Monday, April 27, 2009

[jQuery] Re: ajax append problem

my bad, try this

$(html).find('#cont');
cheers

Michael Lawson
Content Tools Developer, Global Solutions, ibm.com
Phone: 1-828-355-5544
E-mail: mjlawson@us.ibm.com

'Examine my teachings critically, as a gold assayer would test gold. If you find they make sense, conform to your experience, and don't harm yourself or others, only then should you accept them.'

Inactive hide details for "clicforward@googlemail.com" ---04/27/2009 01:17:45 PM---Hello Michael,"clicforward@googlemail.com" ---04/27/2009 01:17:45 PM---Hello Michael,


From:

"clicforward@googlemail.com" <clicforward@googlemail.com>

To:

"jQuery (English)" <jquery-en@googlegroups.com>

Date:

04/27/2009 01:17 PM

Subject:

[jQuery] Re: ajax append problem





Hello Michael,

thanks for this.
I got a error: > html.find is not a function
Any idea?

<script type='text/javascript' src='http://ajax.googleapis.com/ajax/
libs/jquery/1.3.2/jquery.min.js'></script>
<script type="text/javascript">
$(document).ready(function(){
$.ajax({
  url: "leistung.html",
  cache: false,
  success: function(html) {
    var loadCont = html.find('#cont');
$(".content").append(loadCont);
  }
});
});
</script>


On Apr 27, 5:07 pm, Michael Lawson <mjlaw...@us.ibm.com> wrote:
> instead of  $(".content").append(html);
> do
> var contentToAppend = html.find("#cont");
> $(".content").append(contentToAppend);
>
> cheers
>
> Michael Lawson
> Content Tools Developer, Global Solutions, ibm.com
> Phone:  1-828-355-5544
> E-mail:  mjlaw...@us.ibm.com
>
> 'Examine my teachings critically, as a gold assayer would test gold. If you
> find they make sense, conform to your experience, and don't harm yourself
> or others, only then should you accept them.'
>
>   From:       "clicforw...@googlemail.com" <clicforw...@googlemail.com>                                                          
>
>   To:         "jQuery (English)" <jquery-en@googlegroups.com>                                                                    
>
>   Date:       04/27/2009 11:03 AM                                                                                                
>
>   Subject:    [jQuery] ajax append problem                                                                                        
>
> Hello,
>
> im using this script to load a external site into my DOM.
> It works fine but i need just a part of this test.html.
>
> For example: I want to append just the div "#cont" from test.html
> How can i do that?
>
> <script type="text/javascript">
> $.ajax({
>   url: "test.html",
>   cache: false,
>   success: function(html){
>     $(".content").append(html);
>   }});
>
> </script>
>
> Thanks for Help!
>
>  graycol.gif
> < 1KViewDownload
>
>  ecblank.gif
> < 1KViewDownload


No comments: