[jQuery] Re: How do I extract a part of received data

2009-09-29 Thread FernandoCE

Hello everybody, i have this code:

$.ajax({
type: "GET",
url: "latest-tweet.php",
cache: false,
success: function(html){
}
});

And my latest-tweet.php returns:


user->name?>
text?>


I wanna get the text's div.detail that de var html bring to compare..
how can I do this?!

Thanks!

On 22 set, 10:58, Frederik  wrote:
> Thanks for your reply Rodrigo.
>
> On Sep 21, 10:57 am, Rodrigo Sebastián Alfonso
>
>  wrote:
> > let's say you have "World" in data, you have to do this:
>
> > $("div").find("p").html($("div").find("p").html() + data);
>
> > so your html would look like:
>
> > HelloWorld
>
> > On Mon, Sep 21, 2009 at 11:49 AM, Frederik  wrote:
>
> > > Anyone has any idea ?
>
> > > I have tried this way.
> > > $("Hello").find("p").appendTo("#content");  //
> > > works... it append Hello
>
> > > I have tried it with all the content of data parameter
> > > $(data).appendTo("#content");  //works - add all the DOM received in
> > > Data
>
> > > The problem is when I try to extract a part of data, it does not work
> > > $(data).find("p").appendTo("#content"); // Does not find the Hello > > p> part
>
> > > Thanks in advance for your help
>
> > > On Sep 18, 10:34 am, Frederik  wrote:
> > > > Wrong syntax?  Please explain.
>
> > > > I try to use this instruction found onhttp://www.visualjquery.com/:
> > > > jQuery(expression, context)
>
> > > > > The core functionality of jQuery centers around this function.
> > > Everything in jQuery is based upon this, or uses this in some way. The 
> > > most
> > > basic use of this function is to pass in an expression (usually consisting
> > > of CSS), which then finds all matching elements.
>
> > > > > By default, if no context is specified, $() looks for DOM elements
> > > within the context of the current HTML document. If you do specify a
> > > context, such as a DOM element or jQuery object, the expression will be
> > > matched against the contents of that context
>
> > > > > Example
>
> > > > > Finds all div elements within an XML document from an AJAX response.
> > > > > jQuery Code
>
> > > > > $("div", xml.responseXML);
>
> > > > Please do not tell me this is because this is for XML data only. I
> > > > read Ajax request may return HTML data and will process it as well.
> > > > In fact, I already use $get() (an AJAX calling function) that return
> > > > HTML.
>
> > > > On Sep 18, 8:07 am, lanxiazhi  wrote:
>
> > > > > this :
> > > > > var elem = $('#section_news', data);
> > > > > is not the right syntax.
>
> > --
> > Rodrigo Alfonso


[jQuery] Re: How do I extract a part of received data

2009-09-22 Thread Frederik

Thanks for your reply Rodrigo.

On Sep 21, 10:57 am, Rodrigo Sebastián Alfonso
 wrote:
> let's say you have "World" in data, you have to do this:
>
> $("div").find("p").html($("div").find("p").html() + data);
>
> so your html would look like:
>
> HelloWorld
>
>
>
> On Mon, Sep 21, 2009 at 11:49 AM, Frederik  wrote:
>
> > Anyone has any idea ?
>
> > I have tried this way.
> > $("Hello").find("p").appendTo("#content");  //
> > works... it append Hello
>
> > I have tried it with all the content of data parameter
> > $(data).appendTo("#content");  //works - add all the DOM received in
> > Data
>
> > The problem is when I try to extract a part of data, it does not work
> > $(data).find("p").appendTo("#content"); // Does not find the Hello > p> part
>
> > Thanks in advance for your help
>
> > On Sep 18, 10:34 am, Frederik  wrote:
> > > Wrong syntax?  Please explain.
>
> > > I try to use this instruction found onhttp://www.visualjquery.com/:
> > > jQuery(expression, context)
>
> > > > The core functionality of jQuery centers around this function.
> > Everything in jQuery is based upon this, or uses this in some way. The most
> > basic use of this function is to pass in an expression (usually consisting
> > of CSS), which then finds all matching elements.
>
> > > > By default, if no context is specified, $() looks for DOM elements
> > within the context of the current HTML document. If you do specify a
> > context, such as a DOM element or jQuery object, the expression will be
> > matched against the contents of that context
>
> > > > Example
>
> > > > Finds all div elements within an XML document from an AJAX response.
> > > > jQuery Code
>
> > > > $("div", xml.responseXML);
>
> > > Please do not tell me this is because this is for XML data only. I
> > > read Ajax request may return HTML data and will process it as well.
> > > In fact, I already use $get() (an AJAX calling function) that return
> > > HTML.
>
> > > On Sep 18, 8:07 am, lanxiazhi  wrote:
>
> > > > this :
> > > > var elem = $('#section_news', data);
> > > > is not the right syntax.
>
> --
> Rodrigo Alfonso


[jQuery] Re: How do I extract a part of received data

2009-09-21 Thread Rodrigo Sebastián Alfonso
let's say you have "World" in data, you have to do this:

$("div").find("p").html($("div").find("p").html() + data);

so your html would look like:

HelloWorld


On Mon, Sep 21, 2009 at 11:49 AM, Frederik  wrote:

>
> Anyone has any idea ?
>
> I have tried this way.
> $("Hello").find("p").appendTo("#content");  //
> works... it append Hello
>
> I have tried it with all the content of data parameter
> $(data).appendTo("#content");  //works - add all the DOM received in
> Data
>
> The problem is when I try to extract a part of data, it does not work
> $(data).find("p").appendTo("#content"); // Does not find the Hello p> part
>
>
> Thanks in advance for your help
>
> On Sep 18, 10:34 am, Frederik  wrote:
> > Wrong syntax?  Please explain.
> >
> > I try to use this instruction found onhttp://www.visualjquery.com/:
> > jQuery(expression, context)
> >
> > > The core functionality of jQuery centers around this function.
> Everything in jQuery is based upon this, or uses this in some way. The most
> basic use of this function is to pass in an expression (usually consisting
> of CSS), which then finds all matching elements.
> >
> > > By default, if no context is specified, $() looks for DOM elements
> within the context of the current HTML document. If you do specify a
> context, such as a DOM element or jQuery object, the expression will be
> matched against the contents of that context
> >
> > > Example
> >
> > > Finds all div elements within an XML document from an AJAX response.
> > > jQuery Code
> >
> > > $("div", xml.responseXML);
> >
> > Please do not tell me this is because this is for XML data only. I
> > read Ajax request may return HTML data and will process it as well.
> > In fact, I already use $get() (an AJAX calling function) that return
> > HTML.
> >
> > On Sep 18, 8:07 am, lanxiazhi  wrote:
> >
> > > this :
> > > var elem = $('#section_news', data);
> > > is not the right syntax.
>



-- 
Rodrigo Alfonso


[jQuery] Re: How do I extract a part of received data

2009-09-21 Thread Frederik

Anyone has any idea ?

I have tried this way.
$("Hello").find("p").appendTo("#content");  //
works... it append Hello

I have tried it with all the content of data parameter
$(data).appendTo("#content");  //works - add all the DOM received in
Data

The problem is when I try to extract a part of data, it does not work
$(data).find("p").appendTo("#content"); // Does not find the Hello part


Thanks in advance for your help

On Sep 18, 10:34 am, Frederik  wrote:
> Wrong syntax?  Please explain.
>
> I try to use this instruction found onhttp://www.visualjquery.com/:
> jQuery(expression, context)
>
> > The core functionality of jQuery centers around this function. Everything 
> > in jQuery is based upon this, or uses this in some way. The most basic use 
> > of this function is to pass in an expression (usually consisting of CSS), 
> > which then finds all matching elements.
>
> > By default, if no context is specified, $() looks for DOM elements within 
> > the context of the current HTML document. If you do specify a context, such 
> > as a DOM element or jQuery object, the expression will be matched against 
> > the contents of that context
>
> > Example
>
> > Finds all div elements within an XML document from an AJAX response.
> > jQuery Code
>
> > $("div", xml.responseXML);
>
> Please do not tell me this is because this is for XML data only. I
> read Ajax request may return HTML data and will process it as well.
> In fact, I already use $get() (an AJAX calling function) that return
> HTML.
>
> On Sep 18, 8:07 am, lanxiazhi  wrote:
>
> > this :
> > var elem = $('#section_news', data);
> > is not the right syntax.


[jQuery] Re: How do I extract a part of received data

2009-09-18 Thread Frederik

Wrong syntax?  Please explain.

I try to use this instruction found on http://www.visualjquery.com/:
jQuery(expression, context)

> The core functionality of jQuery centers around this function. Everything in 
> jQuery is based upon this, or uses this in some way. The most basic use of 
> this function is to pass in an expression (usually consisting of CSS), which 
> then finds all matching elements.
>
> By default, if no context is specified, $() looks for DOM elements within the 
> context of the current HTML document. If you do specify a context, such as a 
> DOM element or jQuery object, the expression will be matched against the 
> contents of that context
>
> Example
>
> Finds all div elements within an XML document from an AJAX response.
> jQuery Code
>
> $("div", xml.responseXML);


Please do not tell me this is because this is for XML data only. I
read Ajax request may return HTML data and will process it as well.
In fact, I already use $get() (an AJAX calling function) that return
HTML.



On Sep 18, 8:07 am, lanxiazhi  wrote:
> this :
> var elem = $('#section_news', data);
> is not the right syntax.


[jQuery] Re: How do I extract a part of received data

2009-09-18 Thread lanxiazhi
this :
var elem = $('#section_news', data);
is not the right syntax.