What Is XHR And Why You Should Be Looking At XMLHttpRequests
Tags: xhr, api, javascript
Published: 2022-11-09 02:05:15

---
title: What Is XHR And Why You Should Be Looking At XMLHttpRequests
published: true
description: What Is XHR And Why You Should Be Looking At XMLHttpRequests
tags: xhr, api, javascript
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/its8nydpusi9ceu420kf.jpg
#published_at: 2022-11-09 01:41 +0000
---

Have you been poking around in the network tab of your browser and seen XHR files come flying in at you? They aren't media, they aren't CSS, they aren't JS... so what are they?

##XMLHttpRequests - What Are They And Why You Should Care

XMLHttpRequests are a way for a web page to request data from a server without having to refresh the page (but it can be used on page load as well). This makes it possible to update parts of a page without having to reload the whole page. XMLHttpRequests are used extensively by modern web applications. In this article, we'll take a look at what XMLHttpRequests are and why you should care about them.
 
An XMLHttpRequest is an object that allows a web page to request data from a server without having to refresh the page. The data can be in the form of text, JSON, XML, or any other format that the server chooses to return. XMLHttpRequests are used extensively by data-heavy, modern websites and mobile apps. 

XMLHttpRequests were first introduced by Microsoft in the late 1990s as part of their [ActiveX technology](https://www.oreilly.com/library/view/learning-javascript/0596527462/ch13s04.html). ActiveX is a now-defunct technology that was used to add interactive content to web pages. The most popular use of ActiveX was for creating ActiveX controls, which are small programs that can be embedded in a web page. These days, XMLHttpRequests are implemented natively by all major browsers and there is no need for ActiveX anymore. 

##Why should you care about XMLHttpRequests?

If you're a developer, then you should care about XMLHttpRequests because they make it possible to use applications like Google Maps without having to reload the page every time you move to a new location. A web app can be data-backed, featuring, for example, lots of [airport status data](https://tsa.report/airport/atl/), without having to be terribly slow. It can also tie in multiple data sources without tremendous amounts of complexity.

Another reason why you might want to care about XMLHttpRequests is if you're interested in web development. Many modern web applications make heavy use of XMLHttpRequests, particularly [SPAs](https://developer.mozilla.org/en-US/docs/Glossary/SPA) and other [API-driven architectures](https://www.dreamcodesoft.com/API-driven-Architecture-simplifying-software-development). Understanding how they work is essential for any aspiring web developer. 

##In Closing

In conclusion, XMLHttpRequests are a way for a web page to request data from a server without having to refresh the page. This makes it possible to update parts of a page without having to reload the whole page -- this is particularly useful for data that is handled on other servers and transmitted through an API service. XMLHttpRequests are used extensively by modern, data-backed web applications and if you want to understand how structured data moves around the web, these are one of the most important data types to understand.