If you're loading in a chunk of HTML, then you can treat that chunk as a
jQuery object. For example, if you have the following HTML code that is
being pulled back from an AJAX call, and you only want to use the div tag
you might do something like this.

REMOTE HTML:
------------
<p>
        This is a paragraph of text that we do NOT want to display in the
site
</p>
<div>
        <img src="jquery.jpg" />
        <span>this is my title</span>
</div>


AJAX CALL:
----------
$.get('somehtmlpage.html',
        // callback function on successful load
        function(data){
                var $myDiv = $('div',data);
        }
);

When your AJAX call returns successfully, you look for a div tag in the
context of the returned piece of HTML. Note that this is untested, but it
should work just fine.


Andy matthews



-----Original Message-----
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Kevz
Sent: Tuesday, June 02, 2009 12:51 PM
To: jQuery (English)
Subject: [jQuery] Create Ajax Request & and edit html request


[b]Hay guys![/b],

I worked with now in jQuery. Property however at present the following
problem:

[i]I provide a AJAX Request. the side is loaded, the parameters all conveyed
and back receives I a complete HTML side. Now I would like to have only
certain elements however from this side, like DIV, SPAN etc.

How can I make with the AJAX Request return in such a way best, which I can
select these elements thereby? Simply it would be unfortunately not
functioned over the function $ ("element"), it. even if I indicate the HTML
Request as secondly parameter.[/i]


Excused, for my bad English. ;-)

Translatertool. There is unfortunately too many words, in order to describe
my problem. ^^


Reply via email to