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

  • SEARCH
  • Home
  • 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 8942439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:30:58+00:00 2026-06-15T11:30:58+00:00

I have been having a few issues with ajax error function getting called while

  • 0

I have been having a few issues with ajax error function getting called while the script is taking a while to load. But I was able to fix it by adding async: false.

E.g:

$.ajax({
    type: 'POST',
    url: REQUEST_URL,
    async: false,
    data: {
        'id': id
    },
    dataType: 'json',
    success: function(output) { 
        // success
    },
    error: function() {
        alert('Error, please refresh the page');
    }
});

When reading the docs it says:

By default, all requests are sent asynchronously (i.e. this is set to
true by default). If you need synchronous requests, set this option to
false. Cross-domain requests and dataType: “jsonp” requests do not
support synchronous operation. Note that synchronous requests may
temporarily lock the browser, disabling any actions while the request
is active. As of jQuery 1.8, the use of async: false with jqXHR
($.Deferred) is deprecated; you must use the complete/success/error
callbacks.

Q) What does the last part mean about jqXHR ($.Deferred)? Does this effect my script?

  • 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-06-15T11:31:00+00:00Added an answer on June 15, 2026 at 11:31 am

    It does not affect your script.

    It means that, when performing synchronous AJAX requests, one should not use the deferred API exposed by the object returned by $.ajax() (like done() or fail() for instance), but rely on the complete and error handlers instead.

    In other words, your code already uses the right pattern. You would have to modify it if it used deferred operations like:

    // Do not write this code.
    $.ajax({
        type: 'POST',
        url: REQUEST_URL,
        async: false,           // <-- Synchronous request.
        data: {
            'id': id
        },
        dataType: 'json'
    }).done(function(output) {  // <-- Use of deferred method.
        // success
    }).fail(function() {        // <-- There also.
        alert('Error, please refresh the page');
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been having a few issues using the quadrature function in python 2.7
So I have built quite a few custom controls and I have been having
I have been having some real trouble with this for a while. I am
I have been having intermittent issues on some servers running Archlinux / php-fpm 5.3.9
I'm having some timeout issues with my WCF services. I've been doing load-testing on
I'm having an issue I've been fighting for a few hours, and have not
Having a few issues trying to think of a good way to have a
I have been having trouble pulling up a custom UIPickerView from the textfield's inputview
I have been having these really odd problems with Visual Studio 2010. At this
I have been having this annoying problem when trying to implement a picture gallery

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.