W3Schools.com

jQuery AJAX ajaxComplete() Method

jQuery AJAX Methods jQuery AJAX Methods

Example

Show a "loading" indicator image while an AJAX request is going on:

$("#txt").ajaxStart(function(){
  $("#wait").css("display","block");
});
$("#txt").ajaxComplete(function(){
  $("#wait").css("display","none");
});

Try it yourself »

Definition and Usage

The ajaxComplete() method specifies a function to be run when an AJAX request completes.

Unlike ajaxSuccess(), functions specified with the ajaxComplete() method will run when the request is completed, even it is not successful.

Syntax

$(selector).ajaxComplete(function(event,xhr,options))

Parameter Description
function(event,xhr,options) Required. Specifies the function to run when the request completes
Additional parameters:
  • event - contains the event object
  • xhr - contains the XMLHttpRequest object
  • options - contains the options used in the AJAX request


jQuery AJAX Methods jQuery AJAX Methods


WEB HOSTING
Best Web Hosting
PHP MySQL Hosting
Best Hosting Coupons
UK Reseller Hosting
Cloud Hosting
Top Web Hosting
$3.98 Unlimited Hosting
Premium Website Design
WEB BUILDING
Download XML Editor
FREE Website BUILDER
Best Website Templates Top CSS Templates
CREATE HTML Websites
EASY WEBSITE BUILDER
W3SCHOOLS EXAMS
Get Certified in:
HTML, CSS, JavaScript, XML, PHP, and ASP
W3SCHOOLS BOOKS
New Books:
HTML, CSS
JavaScript, and Ajax
STATISTICS
Browser Statistics
Browser OS
Browser Display
SHARE THIS PAGE