Monday, April 27, 2009

[jQuery] Re: ajax append problem

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: 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 11:03:13 AM---Hello,"clicforward@googlemail.com" ---04/27/2009 11:03:13 AM---Hello,


From:

"clicforward@googlemail.com" <clicforward@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!


No comments: