tags:

views:

27

answers:

2

Afternoon all,

Using the code below I'm trying to load what is render by the clicked link in to #loader, this works but I don't want the whole page I would like just a selected DIV i.e. #photo.

Whats the right way for this to be done?

$(function() {

$(".style_image a").live('click', function(event) { 
    $("#loader").load(this.href)
    .show();

    $.get(this.href, null, null, "script");
    return false;       

});
});

I've tried:

$("#loader").load('this.href', #photo)

and:

$("#loader").load(this.href #photo)

No success!

p.s. the #loader is originally hide in my css file.

Regards

Mr THOMAS

+2  A: 

You can do it like this:

$("#loader").load(this.href + " #photo");

It needs to be part of the string, with a space in-between.

Also, I'd show it once loaded, like this:

$("#loader").load(this.href + " #photo", function() { $(this).show(); });

This prevents flicker of it showing then getting content in.

Nick Craver
A: 

Hi,

Try and use ('#element).attr('src','http://...');

it should work.

Thanks Jean

Jean
This is not at all what `.load()` does...
Nick Craver