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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:36:38+00:00 2026-05-26T16:36:38+00:00

I saw in jQuery the code : var jqxhr = $.ajax( example.php ) .done(function()

  • 0

I saw in jQuery the code :

var jqxhr = $.ajax( "example.php" )
    .done(function() { alert("success"); })
    .fail(function() { alert("error"); })
    .always(function() { alert("complete"); });

but each ajax Call has also a callback Functions e.g. :

jQuery.ajax({
      ...
      beforeSend: function( xhr ) 
      {

      },
      success: function (data, textStatus, jqXHR)
      {

      }, 
      error: function(jqXHR, error_textStatus, errorThrown)
      {

      },
      complete: function (jqXHR, complete_textStatus)
      {
      }
 });

So what is the difference?

  • 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-26T16:36:38+00:00Added an answer on May 26, 2026 at 4:36 pm

    success, error etc are implemented internally using the deferred object constructed when calling $.ajax(..). So if you simply call the .done, .fail etc methods, you will get the same behaviour.

    The advantage of using the deferred object is that it has some additional functionality that you might want to use. As an example you could perform several async ajax calls, and when they’re all complete continue with some work that needs all calls to be complete. Is very nifty tbh. 🙂

    @Matt Ball: No need to be rude about it. Those are indeed the links you should look up however, Royi. They’ll tell you what you need to know.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making an ajax call in jquery $.get(validate_isbn.php, {isbn: obj[16]}, function(answer) { console.log(answer);
Below is a small snippet from a code I saw with jquery and PHP.
I'm learning jQuery and saw this chunk of code. myJqueryFile.js (function($, undefined) { function
Does jQuery validation plugin have some dependencies? For example, I saw blogposts that said
A sample bit of code: <script type=text/javascript src=http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js></script> <div id=myinfo>info</div> <input id=clickme type=button value=click
Can jquery-ajax reload a div WITH DYNAMIC CONTENTS. For example if i have a
I recently saw this code on another post ( jQuery Set Cursor Position in
I just saw a demo that had this jquery code to show and hide
I recently saw a jQuery example where a POST was made to Default.aspx/Test, where
I saw this line in the jQuery.form.js source code: g && $.event.trigger(ajaxComplete, [xhr, s]);

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.