Szkolenia informatyczne: biuro, technologie internetowe, egzaminy technik

CENA - OFERTA: Jesteś zainteresowany/na kursem – zapraszam do kontaktu ze mną, szczegóły: www.poswojsku.pl .

kurs tworzenie witryn www
szkolenie technik informatyk programista inf.03 ee.09 inf.04 egzamin przygotowanie

 

AJAX XMLHttpRequest xhr SPA what is it

flag language

AJAX XMLHttpRequest xhr SPA what is it

The guide you are currently reading, I wrote to show how to build interactive websites, the so-called Single Page Application. Single Page Application is actually a standard in creating websites. The basis of SPA is AJAX technology and the XMLHttpRequest scripting language object. In the first part I will explain the basic concepts: AJAX, XMLHttpRequest, xhr, SPA, JavaScript.

AJAX (Asynchronous JavaScript and XML or asynchronous JavaScript and XML) is a technique for creating technologically advanced websites and web applications. AJAX allows user interaction with the server without reloading the entire page content, asynchronously. AJAX enables a more dynamic interaction with the user than in the traditional model, in which each request for new data involves sending the entire document, e.g. an HTML page. If you want to learn more about HTML technology - check out my training in creating responsive websites: https://www.poswojsku.info/Technologie-internetowe-web-development-HTML5-CSS3-JavaScript.html .

One of the most important elements in AJAX technology is the XMLHttpRequest object. All AJAX is based on the methods and properties of the XMLHttpRequest object. Therefore, understanding XMLHttpRequest is the most important part of this guide.

A characteristic feature of XMLHttpRequest is the ability to perform web page user requests after the page loads. Thanks to this, you don't have to reload the entire page, only some of its elements. What is this magic XMLHttpRequest object?

XMLHttpRequest

XMLHttpRequest (XHR) is an object of scripting languages, also JavaScript. It is supported by web browsers - it enables sending requests to a www server using the http protocol. XMLHttpRequest combines data with a page view. The responses received from the server are used to modify the loaded document. Due to the asynchronous execution of requests, they are executed in the background and do not interrupt the user's interaction with the site, dynamically changing it. Server responses are usually transmitted in JSON, XML or plain text formats. When using JavaScript on a page, the JSON format is usually used because it is a subset of JavaScript and works very well with Single Page Apps created in JavaScript.

A characteristic feature of XMLHttpRequest is the ability to make requests after the web page loads while interacting with the user.

AJAX XMLHttpRequest xhr SPA what is it?

XMLHttpRequest methods

AJAX XMLHttpRequest xhr SPA JavaScript what is it

abortion()

Cancels the current request

getAllResponseHeaders ()

Returns the complete set of HTTP headers as a string.

getResponseHeader( headerName )

Returns the value of a specific HTTP header.

open( metoda, URL ), open( metoda, URL, async ), open( metoda, URL, async, userName ), open( metoda, URL, async, userName, password )

Specifies the method, URL, and other optional request arguments.

AJAX XMLHttpRequest xhr SPA what is it

The method argument can be "GET", "POST", "HEAD", "PUT", "DELETE" or other HTTP methods listed in the W3C specification. The URL argument can be both a relative and an absolute address. The "async" argument specifies whether the request should be processed asynchronously or not - for 1 ("true") the script will be further processed after the send () method is used, and for 0 ("false") the script will be processed only after the response is received.

send (content)

Sends a request.

setRequestHeader (header name, header content)

Adds a header / content pair to HTTP requests.

I cordially invite you to the second part of the guide: AJAX XMLHttpRequest xhr SPA what is it. You will find specific AJAX request codes in it, along with practical application.

Good luck building an AJAX based application. I invite you to my next guides. See in the side menu similar tips to: AJAX XMLHttpRequest xhr SPA what is it?

 

See in the menu similar articles to: AJAX XMLHttpRequest xhr SPA what is it?

 

Angielski
szkolenia bezpłatne kolejne lekcje
kursy, porady, artykuły znajdziesz w Menu Tematycznym