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 5948671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:08:28+00:00 2026-05-22T17:08:28+00:00

Before submitting a form button, I make a $.getJSON call that validates some of

  • 0

Before submitting a form button, I make a $.getJSON call that validates some of the data, and when it comes back, it either displays a “you didn’t fill out this form correctly” dialog or it does the form.submit(). But sometimes, especially on my slow test server, it takes a few seconds before the callback is called, and so I’d like to put up some visual indication (disabled buttons, wait cursors, etc) that you have pressed the button, and then turning off that visual indication in the callback. But I’m told that there is a small but non-zero chance that the callback might not be called.

What is the best practice to make sure that in that situation, I don’t end up with a non-functional form?

  • 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-22T17:08:29+00:00Added an answer on May 22, 2026 at 5:08 pm

    You can use $.ajax with an .error callback in addition to the .success callback instead of $.getJSON. If the request fails, the .error callback will fire. You can use that to re-enable and display a suitable message, similar to the one shown on StackOverflow when a vote fails. Example:

    $.ajax({
      url: "test.html",
      dataType: "json",
      success: function(html){
         $form.submit();
      },
      error: function(xhr, error){
         console.debug(xhr); 
         console.debug(error);
         $form.find(":input").attr("disabled", false);
      }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Django form that needs to do some client-side validation before submitting
I am creating a form that requires user confirmation before submitting the data. I
I have a form that contains a bunch of checkboxes. Before submitting the form,
DetailsView1.DefaultMode = DetailsViewMode.Insert; After inserting how can i Preview Data before Submitting/Inserting data in
I am trying to display jquery's dialog confirmation before submitting a form. But I
I wanted to check validation of certain field before submitting a form . <form
I have multple objects. Before submitting a form, I want to check to be
I have number of conditions i'd like to check before submitting a form so
Before I jump headlong into C#... I've always felt that C, or maybe C++,
Hi i was im trying to make a jquery ajax submit form, and im

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.