• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

AJAX loading gif different for different form submits

 
Ranch Hand
Posts: 91
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I have a page where I have 3 forms. I want to show 3 different gifs when i submit different submits, but instead, it shows the same image for all the three. Also, its inconsistent as sometimes it shows the gif on first click and then not on the next two clicks, sometimes it shows on all three, but after that if I click on submit again result is shown but it does not show to loading gif image. Here is my code:


I tried to use different div ids for 3 different images wait, wait1 and wait3, changed waits in this:

and added the div id=wait inside the 3 different div containers, nothing seems to work.
 
Sheriff
Posts: 67756
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
Why is your script mixed in with your markup? Makes it really hard to find and read. Follow conventions and either place it in the head, or at the tail of the body.

In any case, that's a lot of code to look at. Perhaps you could use a debugger to narrow it down to where it's not doing what you expect and direct our attention to it.
 
Ranch Hand
Posts: 243
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Arushi,

ajaxStart is a global ajax event handler ( think of it as a configuration which needs to be done only once ). If you're doing it thrice the last executed code is going to override the previously setup configuration. If you want to show different images based on forms , the handler function should do some work to identify who triggered the ajax call and make the decision as to what image needs to be shown.

Thanks
Srikkanth
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic