I realize this is possible. But, like the title of this message
suggests, I don't to put the logic to replace the image for each
event. I will end up with more than 100 events on this page.

If I could have the elements being replaced by ajax, first replaced
with the wait image automatically when I call $(obj).load() that would
be perfect! If it's not possible I will go ahead and implement your
solution Wizzud.



On Oct 11, 4:23 am, Wizzud <[EMAIL PROTECTED]> wrote:
> ajaxSend is a global event that *every* bound listener will pick up.
> You're binding listeners to all the elements that you *could* click on
> to initiate the ajax call, but the ajax call does not know (or care)
> what was clicked on, it just knows it has something to send.
>
> You must have click event handlers bound to the .control elements in
> order to initiate the ajax call, so why not simply replace the image
> on the clicked element prior to making the ajax call?
>
> eg.
> $('.control').click(function(e){
>     $(this)......// replace image with 'waiting' image
>     $.ajax(....); // make ajax call
>   });
>
> On Oct 10, 3:38 pm, Mark <[EMAIL PROTECTED]> wrote:
>
> > Let's say I have 10 icons on a web page. Clicking an icon will change
> > it from it's colored version to it's gray scale version.  Changing
> > flag states if you will. Lets say, just for example, it takes 3 - 5
> > seconds for the icon to change because it has to wait on the server to
> > process the request and return the icon that represents the result
> > (special icon for failures). I want a wait image to replace the icon
> > that was clicked while waiting on the server.
>
> > I have tried something like this
>
> > $('.control').ajaxSend(
> >   function() {
> >     $(this).replaceWith('images/wait.gif');
> >   });
>
> > This:
> > $('.control').ajaxSend(
> >   function(evt) {
> >     $(evt.target).replaceWith('images/wait.gif');
> >   });
>
> > and This:
> > $('.control').each(
> >   function() {
> >     $(this).ajaxSend(
> >       function() {
> >         $(this).replaceWith('images/wait.gif')
> >       }
> >     )
> >   });
>
> > They all give me the same result... all the objects with the class
> > 'control' are replaced with the wait image and not just the one that
> > was clicked. I thought for sure the last one would work ;(.
>
> > <strong>Plain Text Test</strong>

Reply via email to