sequenceDiagram
participant Client
participant Server
Client->>Server: Initial Request
Server->>Client: HTML File
Client->>Server: Subsequent Request
Server->>Client: HTML File
Client–Server Communication
Seoul National University of Science and Technology
Information Technology Management
Lecture slides index
April 23, 2026
fetch() to request data
Important
fetch() is how the browser communicates with a server
Two main participants:
They communicate over HTTP: the client issues a request, and the server returns a response, forming the standard request/response cycle.

server1.com, server2.com, and server3.com.
Disadvantages:
sequenceDiagram
participant Client
participant Server
Client->>Server: Initial Request
Server->>Client: HTML File
Client->>Server: Subsequent Request
Server->>Client: HTML File
The relationship between the server and client in the server-side rendering approach
sequenceDiagram
participant Client
participant Server
Client->>Server: Initial Request
Server->>Client: HTML File
Client->>Server: AJAX Call
Server->>Client: JSON Payload
The relationship between the server in the AJAX approach
content-type, content-lengthkeep-alive, upgrade-insecure-requestsaccept, accept-encoding, accept-language, host and user-agent
content-type, content-encoding, last-modifiedconnection, date, keep-alive, transfer-encodingaccess-control-allow-origin, etag, server, set-cookie, vary, x-frame-optionsX-Frame-Options prevents framingFeature-Policy can disable camera/microphone, etc.
The most common status codes are:

(CRUD) are the four basic operations or actions of persistent storage.
REST stands for Representational State Transfer
Architectural style for designing web APIs
Resources
Server Response

fetch()fetch() function returns a PromisePromise is the Response object representing the HTTP response from the APIstatusCheck()const BASE_URL = "some_base_url.com"; // you may have more than one
async function makeRequest() {
let url = BASE_URL + "?query0=value0"; // some requests require parameters
try {
let result = await fetch(url)
await statusCheck(result)
// result = await result.text(); // use this if your data comes in text
// result = await result.json(); // or this if your data comes in JSON
processData(result)
} catch (err) {
handleError(err); // define a user-friendly error-message function
}
}
function processData(responseData) {
// Do something with your responseData! (build DOM, display messages, etc.)
}
async function statusCheck(res) {
if (!res.ok) {
throw new Error(await res.text());
}
return res;
}
Web Programming