Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Ajaxstart/Ajaxstop Global Handler Form Reference

 
Mark Reyes
Ranch Hand
Posts: 426
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
everytime.

Any hints please..
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64683
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Mark Reyes
Ranch Hand
Posts: 426
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic