Thanks Gavin, it's indeed a possibility. i do think it would be useful
to store the target element receiving the loaded content, hence my
posting on the jquery-dev list.
maybe something like:  $.ajax.targetNode  ?

On Fri, Mar 6, 2009 at 1:30 PM, d3r1v3d (Gavin Mulligan)
<[email protected]> wrote:
>
> After looking at in the $.ajax(...) function, which is implicitly
> invoked via $.load(...), I noticed that the 'ajaxStart' event is
> triggered explicitly using jQuery.event.trigger(...). Therefore, I
> don't think the event is triggered on a specific element (which would
> obviously allow you to access it via 'this').
>
> However, I see a number of solutions which might fit the bill for you
> application. Have you thought of using the new Event.live(...)
> functionality (http://docs.jquery.com/Events/live)? You could include
> something similar to the following code:
>
> $('button.ajax').live('click', function(){
>    var $loadTarget = $(this);
>    $loadTarget.css(
>        top: $loadTarget.offset().top,
>        left: $loadTarget.offset().left,
>        width: $loadTarget.width(),
>        height: $loadTarget.height()
>    ).show();
>
>   // ajax stuff here
> });
>
> Every button inserted into your page DOM with the class 'ajax' would
> have this click handler bound to them. You could get fancier by
> including attributes such as ajaxURL="..." to these buttons and having
> the click handler invoke the Ajax call using each button's specific
> URL.
>
> Just an idea.
>
> - Gavin
>
> On Mar 6, 6:20 am, Alexandre Plennevaux <[email protected]> wrote:
>> i know, i have no problem to make my script work if i specifically
>> tweak my load() calls but i would like to set it in one place.
>>
>> See:  http://pixeline.be/test/loadanim/demo.html
>>
>> The buttons use the same div, shape it to the same size as the load
>> container and display it. i would like to automate that behaviour
>> instead of having to attach it to all 'click' events.
>>
>> On Fri, Mar 6, 2009 at 12:09 PM, d3r1v3d (Gavin Mulligan)
>>
>> <[email protected]> wrote:
>>
>> > For the throbber div you mentioned, why not initialize it just before
>> > you make the call to load()? As the name suggests, all Ajax calls are
>> > asynchronous, so you could initialize the throbber div to start
>> > displaying 'Loading... Please Wait' just before you make the call and
>> > then hide this loading notification div in the success function
>> > attached to the Ajax call.
>>
>> > Hope this helps.
>>
>> > - Gavin
>>
>> > On Mar 6, 5:59 am, pixeline <[email protected]> wrote:
>> >> Hello,
>>
>> >> I'm trying to set a function that should be triggered on all ajax
>> >> start events. Therefore i thought i should use
>>
>> >> $.ajaxStart(myFunc);
>>
>> >> What my function should do is overlay the specific DOM element that
>> >> will receive the new content with a throbber, "please wait" div,
>> >> typically the element against which load() is called. yet i can't find
>> >> a way to get it from inside the function.
>>
>> >> Suggestion: shouldn't the target element be stored in the ajax
>> >> object ?
>>
>> >> I've posted on hte general jquery for answers before posting it here 
>> >> :http://groups.google.com/group/jquery-en/browse_thread/thread/df7f42a...
>>
>> >> Feel free to reply there if you think my suggestion is not relevant.
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to