Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1014669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:17:04+00:00 2026-05-16T10:17:04+00:00

I have a form with two places that use ajax to submit the information

  • 0

I have a form with two places that use ajax to submit the information to server.

 $("#loading img").ajaxStart(function(){ // this progress bar is used by both ajax submission.
   $(this).show();
 }).ajaxStop(function(){
   $(this).hide();
 });

 <div id="loading">
<img src="loading4.gif" border="0" />
</div>

 $('#countyForm').ajaxForm(options); // Case I: use ajax to submit the form


 $('form#carSelect').change(function(){ // Case II: use ajax to submit the field
$.ajax({
    ...
   }
 });
});

How can I customize the ajax in jQuery so that I can use different progressbar for different ajax submission.

Say for case I, I use image1 and case II I use image2.

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T10:17:05+00:00Added an answer on May 16, 2026 at 10:17 am

    Similar jsFiddle Example w/o ajaxForm

    Instead of using Ajaxstart and stop, just show the individualized loading image first, then fire the Ajax directly. Ajaxstop fires when all the ajax is done on a page. You want individualized attention.

    The ajaxForm plugin allows for a callback function for after the AJAX has fired. Use this to remove your custom animation. Separately bind a click event handler to the form’s submit button to load that custom animation. I haven’t used that plugin, so there may be an easier way.

    For the other case, simply load the custom image, call the AJAX and remove the image on success.

    // Case I --------------------------------
    
    // Bind the event handler to the #countyForm submit button
    $("#countyForm:submit").click(function() {
        // Throw in the customized loading animation when the form is submitted.
        $("#idToShowLoading1").html('<img src="custom1.gif" />');
        // .ajaxForm() handles the AJAX and the success.
    });
    
    // Make use of ajaxForm to handle your form 
    $('#countyForm').ajaxForm(function() {
        // remove loading img
        $("#idToShowLoading1").html('');
        // Haven't used this plugin, but your options, etc here
    });
    
    // Case II --------------------------------
    
    $("form#carSelect").change(function() {
        // First throw in the customized loading animation
        $("#idToShowLoading2").html('<img src="custom2.gif" />');
        // Then make the Ajax call. 
        $.ajax({
          url: 'yoururlhere.html/blah.php',
          success: function(data) {
            // remove loading img or replace it w/ content
            $("#idToShowLoading2").html('');
            // success stuff goes here         
          }
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two functions to add and remove table rows that contain a form
I have a form like this: <form name=mine> <input type=text name=one> <input type=text name=two>
In my document I have this script: $.ajax({ type:POST,url:ajax.php,data:data, success: function() { //onsuccess },
I currently have a PHP form that uses AJAX to connect to MySQL and
I have a form with two select boxes that are used to move values
I have two classes which look like this in barebones form: @interface GraphNode {
I have a form in VB6 with two combo boxes (cboCustomer and cboItemNumber). When
I have two different grid controls on the same form. They share the same
I have two forms, form A and form B. These forms must differ in
I've got a form where I have two radio buttons and two interchangeable controls

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.