Get to know MDN better
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
* Some parts of this feature may have varying levels of support.
Note: This feature is available in Web Workers, except for Service Workers.
The XMLHttpRequest API enables web apps to make HTTP requests to web servers and receive the responses programmatically using JavaScript. This in turn enables a website to update just part of a page with data from the server, rather than having to navigate to a whole new page. This practice is also sometimes known as AJAX.
The Fetch API is the more flexible and powerful replacement for the XMLHttpRequest API. The Fetch API uses promises instead of events to handle asynchronous responses, integrates well with service workers, and supports advanced aspects of HTTP such as CORS. For these reasons, the Fetch API is usually used in modern web apps instead of XMLHttpRequest.
The central interface in the XMLHttpRequest API is XMLHttpRequest. To make an HTTP request:
For an in-depth guide to the XMLHttpRequest API, see Using XMLHttpRequest.
An object representing <form> fields and their values, which can be sent to a server using XMLHttpRequest or fetch().
ProgressEventA subclass of Event which is passed into the progress, and which contains information about how much of the request has been completed.
XMLHttpRequestRepresents a single HTTP request.
XMLHttpRequestEventTargetA superclass of both XMLHttpRequest and XMLHttpRequestUpload, defining the events that are available in both of those interfaces.
XMLHttpRequestUploadRepresents the upload process for an HTTP upload. Provides events enabling code to track the progress of an upload.
In this example we fetch a JSON file from https://raw.githubusercontent.com/mdn/content/main/files/en-us/_wikihistory.json, adding event listeners to show the progress of the event.
| XMLHttpRequest |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Aug 26, 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.