Data Access Using HTTP: Definition & Purpose

Instructor: Alexis Kypridemos

Alexis is a technical writer for an IT company and has worked in publishing as a writer, editor and web designer. He has a BA in Communication.

This lesson defines data access using HTTP, discusses how to make HTTP requests and considers popular methods used, like GET and POST, as well as the benefits of using XHR and jQuery.

Data Access Using HTTP - Definition and Purpose

Data access, also referred to as direct data access or direct web access, is a way to transfer data to and from a web server, or make changes to that data, without having to use one of the traditional tools for accomplishing these tasks, such as an FTP client.

There are different ways, or network protocols, for connecting to a web server and working with the data stored there. Two of the most common are:

  • HTTP, Hypertext Transfer Protocol
  • FTP, File Transfer Protocol

Network protocols determine how devices connect and transfer data over a network.

HTTP is the protocol used by web browsers to connect to web servers and load web pages, among other tasks.

Generally speaking, HTTP is more convenient for working with the data stored in files without having to transfer the files themselves, which is traditionally what FTP is used for. For instance, when navigating to a URL, such as, the browser sends a request to the server to get the contents of the home page, without downloading any files to the device.

HTTP Requests and Methods

In HTTP, each ''action'' the user performs is called a request to the server. Each request must use one of several predefined methods, such as:

  • GET
  • POST
  • PUT

There are other methods, but these are the most common. Methods describe the type of action the user wants to perform with the specified resource. For instance, GET is used to retrieve the contents of a file or other resource stored on a web server (think ''view'' or ''download''). POST and PUT are used for sending data to a server, with PUT in particular being used to update contents of files and resources.

HTTP Request Structure

Each HTTP request must follow a specific structure. This consists of:

  • A request-line
  • Header (optional)
  • A blank line, marking the end of the header
  • A message-body (optional)

The request-line specifies three things:

  • Method, like GET, POST, etc.
  • URI, like
  • HTTP version. The most widely supported version is 1.1.

Here's an example request-line a browser would send to the server when loading its home page:


In the request-line, each piece of information must be separated by a single space, and the end of the line is marked by a CRLF, Carriage Return Line Feed (think pressing the ''Enter'' key).

The optional header contains additional information about the request, such the character encoding to be used for the content, whether to use authorization (username, password), and other details.

The message-body becomes important when sending data to the server, as when using the POST and PUT methods. This is the section of the request that contains the data being sent. By contrast, when using the GET method simply to retrieve data from the server, the message-body is not required.

HTTP Requests Using XHR and jQuery

XHR is short for XMLHttpRequest. This is a JavaScript object supported by all modern web browser versions. It is used for making HTTP requests to a web server.

Why Is It Used?

XHR goes hand in hand with the concept of AJAX, Asynchronous JavaScript And XML. The key feature of this is the ''Asynchronous'' aspect.

Asynchronous vs. Synchronous Requests

It is easier to understand the asynchronous aspect by comparing it to a web page or web app that does not use it.


Consider a web page where the user must login with username and password. Without using XHR and AJAX, the login process would most likely occur as follows:

Step 1 - On the login page, the user enters his or her credentials and clicks ''Submit''.

Step 2 - The credentials entered are sent to a server-side program, which is written in a language like PHP or ASP.NET. This program evaluates whether the credentials are correct. Sending these details to that program occurs through a new HTTP request, using the POST method.

Step 3 - Having checked the credentials, the server-side program loads a new page or message in the user's browser. If the credentials are correct, the new page is the one the user wanted to log into. If the credentials are not correct, the new page is likely to be the login page reloaded, with a message alerting the user that the entered credentials were incorrect.

Depending on the speed of the user's connection, the loading of the new page in Step 3 can add significant time to the process.

To unlock this lesson you must be a Member.
Create your account

Register to view this lesson

Are you a student or a teacher?

Unlock Your Education

See for yourself why 30 million people use

Become a member and start learning now.
Become a Member  Back
What teachers are saying about
Try it risk-free for 30 days

Earning College Credit

Did you know… We have over 200 college courses that prepare you to earn credit by exam that is accepted by over 1,500 colleges and universities. You can test out of the first two years of college and save thousands off your degree. Anyone can earn credit-by-exam regardless of age or education level.

To learn more, visit our Earning Credit Page

Transferring credit to the school of your choice

Not sure what college you want to attend yet? has thousands of articles about every imaginable degree, area of study and career path that can help you find the school that's right for you.

Create an account to start this course today
Try it risk-free for 30 days!
Create an account