It's not a secret anymore!
The moose likes HTML, CSS and JavaScript and the fly likes Ajaxstart/Ajaxstop Global Handler Form Reference Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Ajaxstart/Ajaxstop Global Handler Form Reference" Watch "Ajaxstart/Ajaxstop Global Handler Form Reference" New topic

Ajaxstart/Ajaxstop Global Handler Form Reference

Mark Reyes
Ranch Hand

Joined: Jul 09, 2007
Posts: 426
Hi All,

So I have a different problem this time.
And I still have this HTML with many forms inside it. I submit each form thru jquery form plugin ajaxSubmit().

Now, I want to attach some sort of a loading ui that will tell the user that their comments
are being added to DB.
My problem is how will I know the ID of the div to which I can attach this div together with
the ajaxStart and ajaxStop global handler.

Maybe this would help as an added info, I place each form on a Jquery UI accordion widget so thats why
I need to know the name of the div where I can attach it so that user will see the loading div.

I basically doesnt want a top level div (outside the accordion) like this

I want it to be shown on each accordion ui tab.

I check out the Jquery manual and can't see any options that will tell you where it came. According to the jqia book also, these are global functions also and is fired up

Any hints please..

Sean Clark ---> I love this place!!!
Me ------> I definitely love this place!!!
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63857

I'm not quite sure what you are trying to accomplish, but the first step is to identify what this is pointing to in your callback. Most often that gives you enough context to find related elements.

[Asking smart questions] [About Bear] [Books by Bear]
Mark Reyes
Ranch Hand

Joined: Jul 09, 2007
Posts: 426
Hi Bear,

Thanks. Allow me to explain further.

I wanted to show a loading div but I wanted it to be shown on only the
form the initiated the ajax request.

Say I initiated the ajax request on id="formSubmit-1", then I wanted to
display the Loading Div on that form. Same as when the ajax request happens
on the other form.

My problem is, using the ajaxStart function, I dont have the chance to know
to which form the ajax request came from.

As per the this keyword, as I know, the .ajaxStart() is implemented as a method of
jQuery object instances,so the this keyword refers to the selected elements within the callback function
I agree. Here's the link:
subject: Ajaxstart/Ajaxstop Global Handler Form Reference
It's not a secret anymore!