Thanks for the replies guys. Unfortunately, I don't have access to the server
(hence the need to use Greasemonkey).

I think I'm about 90% there at the moment, I'm just having a problem
specifying the div to put the ajaxed content into.

This is the basic html structure of the page the content goes into (after I
have inserted a div with jQuery): http://pastebin.com/898033

And this is my code so far:

$('[EMAIL PROTECTED]').parent().parent().addClass('ajaxClick');
$('<div class="newDiv"></div>').insertAfter(".ajaxClick");
$(".newDiv").hide();
$('.ajaxClick a').click(function(){
$(this).parent().parent().siblings(".newDiv:first").load(this.href,
function(){
$('.newDiv>div, .newDiv>table, .newDiv>p:first, .newDiv>p:last
table:lt(2)').hide(); //hides the stuff I don't want from the page I'm
requesting
$(".newDiv p").css("margin", "0");
});
var divHite = $(".newDiv").height();
$(this).parent().parent().siblings(".newDiv:first").animate({height:
divHite}, 500);
return false});

I'm getting and parsing the page I need via ajax just fine, the problem is,
I can't figure out how to make it load in the sibling next to the parent of
the parent of the a tag. (I hope that makes sense :-)

At the moment, it is always loading in to the very first "newDiv" sibling
div.


Alex Cook wrote:
> 
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
> Behalf Of Yansky
> Subject: [jQuery] Retrieve content from element using AJAX?
> 
> Is it possible to retrieve specific content from another page, rather
> than
> the whole page when using AJAX?
> 
> -----
> 
> Short answer is no, there is no such functionality.  You can however
> fudge a few things to make it appear that you are only loading a
> fragment.  I had to do something like this recently, so if anyone has a
> better way to do this let me know.
> 
> http://pastebin.com/897708
> 
> Go look at the code and you'll see what I did was pretty basic.  I just
> loaded the page (in this example the .load() function entry from the API
> docs) into a hidden div, created a reference to that div, and then
> pulled out the information I wanted and spit it out via console.log().
> You could easily grab the fragment you wanted from the loaded page and
> pipe it into your display area as desired using the same technique.
> 
> Again, if there's a better way, please let me know as this seemed a
> little cumbersome to me but I was unable to figure out a different
> method.
> 
> -ALEX
> 
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Retrieve-content-from-element-using-AJAX--tf3380696.html#a9447490
Sent from the JQuery mailing list archive at Nabble.com.


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to