• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Ajaxstart/Ajaxstop Global Handler Form Reference

 
Ranch Hand
Posts: 426
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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..
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
reply
    Bookmark Topic Watch Topic
  • New Topic