[jQuery] Re: Can I get the contents from respose by ajax

2009-01-13 Thread David .Wu

never mind, it's really work now, filter is great, thanks.

On 1月13日, 下午7時19分, "David .Wu"  wrote:
> nope, it's doesn't work, I type the wrong character but something
> interesting happened
>
> $('#response').html($(res).filter('#a').text());  <- it's not work
> $('#response').html($(res).filter('$a').text());  <- it's give me 123,
> but not truly work,
> $('#response').html($(res).text());  <- it's not work the same meaning
> like above, it response text part from responseText
>
> On 1月12日, 下午5時03分, Balazs Endresz  wrote:
>
> > Use filter with $.ajax:
> > $('#response').html($(res).filter('#a').text());
>
> > On Jan 12, 9:30 am, "David .Wu"  wrote:
>
> > > And I found the load is not work either, because it still get the
> > > construct not the value
> > > for example
>
> > > 
>
> > > $(document).ready(function)
> > > {
> > > $('#test').load('ajax.php #a');
>
> > > });
>
> > > and the result was
> > > 123, what I exactly want is
> > > 123
>
> > > On 1月11日, 下午8時13分, Balazs Endresz  wrote:
>
> > > > As jQuery parses this html the output will contain three elements:
> > > > title, meta, and the div instead of the single html. So .find() won't
> > > > work because it will search in the descendant elements, but filter
> > > > will return '#a' because it's an element of the current jQuery object.
>
> > > > $('') doesn't work either, I guess it's not possible to
> > > > create an html element so easily.
>
> > > > You can also try setting the dataType option to html (or maybe xml).
>
> > > > On Jan 11, 11:13 am, "David .Wu"  wrote:
>
> > > > > I tried all your suggestion, but got some weired result.
>
> > > > > ajax.html
> > > > >  > > > > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> > > > > http://www.w3.org/1999/xhtml";>
> > > > > 
> > > > > 
> > > > > ajax
> > > > > 
> > > > > 
>
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > 
>
> > > > > ajax.php
> > > > >  > > > > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> > > > > http://www.w3.org/1999/xhtml";>
> > > > > 
> > > > > 
> > > > > ajax
> > > > > 
>
> > > > > 
> > > > > test contents
> > > > > 
> > > > > 
>
> > > > > On 1月10日, 上午2時11分, dropcube  wrote:
>
> > > > > > > is there any way to get the value 123 straight from div?
>
> > > > > > yes, just apply a jQuery selector to the response content and get
> > > > > > whatever you need. In this example:
>
> > > > > > $('#a', res).text();
>
> > > > > > OR
>
> > > > > > $(res).find('#a').text();
>
> > > > > > You can also try with $.load that allows you to specify a jQuery
> > > > > > selector in the URL.


[jQuery] Re: Can I get the contents from respose by ajax

2009-01-13 Thread David .Wu

nope, it's doesn't work, I type the wrong character but something
interesting happened

$('#response').html($(res).filter('#a').text());  <- it's not work
$('#response').html($(res).filter('$a').text());  <- it's give me 123,
but not truly work,
$('#response').html($(res).text());  <- it's not work the same meaning
like above, it response text part from responseText

On 1月12日, 下午5時03分, Balazs Endresz  wrote:
> Use filter with $.ajax:
> $('#response').html($(res).filter('#a').text());
>
> On Jan 12, 9:30 am, "David .Wu"  wrote:
>
> > And I found the load is not work either, because it still get the
> > construct not the value
> > for example
>
> > 
>
> > $(document).ready(function)
> > {
> > $('#test').load('ajax.php #a');
>
> > });
>
> > and the result was
> > 123, what I exactly want is
> > 123
>
> > On 1月11日, 下午8時13分, Balazs Endresz  wrote:
>
> > > As jQuery parses this html the output will contain three elements:
> > > title, meta, and the div instead of the single html. So .find() won't
> > > work because it will search in the descendant elements, but filter
> > > will return '#a' because it's an element of the current jQuery object.
>
> > > $('') doesn't work either, I guess it's not possible to
> > > create an html element so easily.
>
> > > You can also try setting the dataType option to html (or maybe xml).
>
> > > On Jan 11, 11:13 am, "David .Wu"  wrote:
>
> > > > I tried all your suggestion, but got some weired result.
>
> > > > ajax.html
> > > >  > > > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> > > > http://www.w3.org/1999/xhtml";>
> > > > 
> > > > 
> > > > ajax
> > > > 
> > > > 
>
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
>
> > > > ajax.php
> > > >  > > > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> > > > http://www.w3.org/1999/xhtml";>
> > > > 
> > > > 
> > > > ajax
> > > > 
>
> > > > 
> > > > test contents
> > > > 
> > > > 
>
> > > > On 1月10日, 上午2時11分, dropcube  wrote:
>
> > > > > > is there any way to get the value 123 straight from div?
>
> > > > > yes, just apply a jQuery selector to the response content and get
> > > > > whatever you need. In this example:
>
> > > > > $('#a', res).text();
>
> > > > > OR
>
> > > > > $(res).find('#a').text();
>
> > > > > You can also try with $.load that allows you to specify a jQuery
> > > > > selector in the URL.


[jQuery] Re: Can I get the contents from respose by ajax

2009-01-13 Thread David .Wu

it's work, thanks

On 1月12日, 下午5時03分, Balazs Endresz  wrote:
> Use filter with $.ajax:
> $('#response').html($(res).filter('#a').text());
>
> On Jan 12, 9:30 am, "David .Wu"  wrote:
>
> > And I found the load is not work either, because it still get the
> > construct not the value
> > for example
>
> > 
>
> > $(document).ready(function)
> > {
> > $('#test').load('ajax.php #a');
>
> > });
>
> > and the result was
> > 123, what I exactly want is
> > 123
>
> > On 1月11日, 下午8時13分, Balazs Endresz  wrote:
>
> > > As jQuery parses this html the output will contain three elements:
> > > title, meta, and the div instead of the single html. So .find() won't
> > > work because it will search in the descendant elements, but filter
> > > will return '#a' because it's an element of the current jQuery object.
>
> > > $('') doesn't work either, I guess it's not possible to
> > > create an html element so easily.
>
> > > You can also try setting the dataType option to html (or maybe xml).
>
> > > On Jan 11, 11:13 am, "David .Wu"  wrote:
>
> > > > I tried all your suggestion, but got some weired result.
>
> > > > ajax.html
> > > >  > > > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> > > > http://www.w3.org/1999/xhtml";>
> > > > 
> > > > 
> > > > ajax
> > > > 
> > > > 
>
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
>
> > > > ajax.php
> > > >  > > > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> > > > http://www.w3.org/1999/xhtml";>
> > > > 
> > > > 
> > > > ajax
> > > > 
>
> > > > 
> > > > test contents
> > > > 
> > > > 
>
> > > > On 1月10日, 上午2時11分, dropcube  wrote:
>
> > > > > > is there any way to get the value 123 straight from div?
>
> > > > > yes, just apply a jQuery selector to the response content and get
> > > > > whatever you need. In this example:
>
> > > > > $('#a', res).text();
>
> > > > > OR
>
> > > > > $(res).find('#a').text();
>
> > > > > You can also try with $.load that allows you to specify a jQuery
> > > > > selector in the URL.


[jQuery] Re: Can I get the contents from respose by ajax

2009-01-12 Thread Balazs Endresz

Use filter with $.ajax:
$('#response').html($(res).filter('#a').text());

On Jan 12, 9:30 am, "David .Wu"  wrote:
> And I found the load is not work either, because it still get the
> construct not the value
> for example
>
> 
>
> $(document).ready(function)
> {
> $('#test').load('ajax.php #a');
>
> });
>
> and the result was
> 123, what I exactly want is
> 123
>
> On 1月11日, 下午8時13分, Balazs Endresz  wrote:
>
> > As jQuery parses this html the output will contain three elements:
> > title, meta, and the div instead of the single html. So .find() won't
> > work because it will search in the descendant elements, but filter
> > will return '#a' because it's an element of the current jQuery object.
>
> > $('') doesn't work either, I guess it's not possible to
> > create an html element so easily.
>
> > You can also try setting the dataType option to html (or maybe xml).
>
> > On Jan 11, 11:13 am, "David .Wu"  wrote:
>
> > > I tried all your suggestion, but got some weired result.
>
> > > ajax.html
> > >  > > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> > > http://www.w3.org/1999/xhtml";>
> > > 
> > > 
> > > ajax
> > > 
> > > 
>
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
>
> > > ajax.php
> > >  > > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> > > http://www.w3.org/1999/xhtml";>
> > > 
> > > 
> > > ajax
> > > 
>
> > > 
> > > test contents
> > > 
> > > 
>
> > > On 1月10日, 上午2時11分, dropcube  wrote:
>
> > > > > is there any way to get the value 123 straight from div?
>
> > > > yes, just apply a jQuery selector to the response content and get
> > > > whatever you need. In this example:
>
> > > > $('#a', res).text();
>
> > > > OR
>
> > > > $(res).find('#a').text();
>
> > > > You can also try with $.load that allows you to specify a jQuery
> > > > selector in the URL.


[jQuery] Re: Can I get the contents from respose by ajax

2009-01-12 Thread David .Wu

And I found the load is not work either, because it still get the
construct not the value
for example



$(document).ready(function)
{
$('#test').load('ajax.php #a');
});

and the result was
123, what I exactly want is
123

On 1月11日, 下午8時13分, Balazs Endresz  wrote:
> As jQuery parses this html the output will contain three elements:
> title, meta, and the div instead of the single html. So .find() won't
> work because it will search in the descendant elements, but filter
> will return '#a' because it's an element of the current jQuery object.
>
> $('') doesn't work either, I guess it's not possible to
> create an html element so easily.
>
> You can also try setting the dataType option to html (or maybe xml).
>
> On Jan 11, 11:13 am, "David .Wu"  wrote:
>
> > I tried all your suggestion, but got some weired result.
>
> > ajax.html
> >  > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> > http://www.w3.org/1999/xhtml";>
> > 
> > 
> > ajax
> > 
> > 
>
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
>
> > ajax.php
> >  > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> > http://www.w3.org/1999/xhtml";>
> > 
> > 
> > ajax
> > 
>
> > 
> > test contents
> > 
> > 
>
> > On 1月10日, 上午2時11分, dropcube  wrote:
>
> > > > is there any way to get the value 123 straight from div?
>
> > > yes, just apply a jQuery selector to the response content and get
> > > whatever you need. In this example:
>
> > > $('#a', res).text();
>
> > > OR
>
> > > $(res).find('#a').text();
>
> > > You can also try with $.load that allows you to specify a jQuery
> > > selector in the URL.


[jQuery] Re: Can I get the contents from respose by ajax

2009-01-11 Thread Balazs Endresz

As jQuery parses this html the output will contain three elements:
title, meta, and the div instead of the single html. So .find() won't
work because it will search in the descendant elements, but filter
will return '#a' because it's an element of the current jQuery object.

$('') doesn't work either, I guess it's not possible to
create an html element so easily.

You can also try setting the dataType option to html (or maybe xml).

On Jan 11, 11:13 am, "David .Wu"  wrote:
> I tried all your suggestion, but got some weired result.
>
> ajax.html
>  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> http://www.w3.org/1999/xhtml";>
> 
> 
> ajax
> 
> 
>
> 
> 
> 
> 
> 
> 
> 
> 
>
> ajax.php
>  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> http://www.w3.org/1999/xhtml";>
> 
> 
> ajax
> 
>
> 
> test contents
> 
> 
>
> On 1月10日, 上午2時11分, dropcube  wrote:
>
> > > is there any way to get the value 123 straight from div?
>
> > yes, just apply a jQuery selector to the response content and get
> > whatever you need. In this example:
>
> > $('#a', res).text();
>
> > OR
>
> > $(res).find('#a').text();
>
> > You can also try with $.load that allows you to specify a jQuery
> > selector in the URL.


[jQuery] Re: Can I get the contents from respose by ajax

2009-01-11 Thread David .Wu

I tried all your suggestion, but got some weired result.

ajax.html

http://www.w3.org/1999/xhtml";>


ajax












ajax.php

http://www.w3.org/1999/xhtml";>


ajax



test contents



On 1月10日, 上午2時11分, dropcube  wrote:
> > is there any way to get the value 123 straight from div?
>
> yes, just apply a jQuery selector to the response content and get
> whatever you need. In this example:
>
> $('#a', res).text();
>
> OR
>
> $(res).find('#a').text();
>
> You can also try with $.load that allows you to specify a jQuery
> selector in the URL.


[jQuery] Re: Can I get the contents from respose by ajax

2009-01-09 Thread jQuery Lover

I would also suggest to use $load() function in this case. Since it
would make your code much readable.

$('aa.php #a', {a:123}, function(res){
  // res is a responce content
});

Read jQuery HowTo Resource  -  http://jquery-howto.blogspot.com



On Fri, Jan 9, 2009 at 11:11 PM, dropcube  wrote:
>
> You can also try with $.load that allows you to specify a jQuery
> selector in the URL.


[jQuery] Re: Can I get the contents from respose by ajax

2009-01-09 Thread dropcube


> is there any way to get the value 123 straight from div?

yes, just apply a jQuery selector to the response content and get
whatever you need. In this example:

$('#a', res).text();

OR

$(res).find('#a').text();

You can also try with $.load that allows you to specify a jQuery
selector in the URL.