views:

60

answers:

2

I am using ajax to grab a page.

withing a table lies an imagesrc i want to grab.. It is wrapped around an A tag with a class name

i use the following

$response.find(".infobox tr").each(function(){
$a=$(this).find(".image").html();
}

but it returns the image tag <img src="http://uwww.domain.com.au/image.jpg" height="333" width="256">

i have tried the attr("src") and other methods but to no avail.. is there a trick i am missin

+2  A: 
$a=$(this).find(".image img").attr("src")
fl00r
Well that'll correctly set "$a" to the "src" attribute value, but until @Alessandro shows us what "$a" is and how it is used, we don't really know what's wrong with his code.
Pointy
The problem will occur if there MORE than one `img` in `.image` class
fl00r
@fl00r exactly - but we can't advise on how to fix it until we see what that `$a` is supposed to do. Or it could be that there's just on `<img>` tag in his HTML, and that `$a` is being set correctly already, and the error is completely unrelated to this stuff!
Pointy
A: 

try

$a=$(this).find(".image img").attr("src")
Reigel
this works perfectly.. i think my mistake was having the html() at the end..cheers
Alessandro