{"id":9150,"date":"2020-07-29T08:59:28","date_gmt":"2020-07-29T08:59:28","guid":{"rendered":"https:\/\/www.experfy.com\/blog\/?p=9150"},"modified":"2023-11-24T14:13:12","modified_gmt":"2023-11-24T14:13:12","slug":"ajax-and-javascript-with-examples","status":"publish","type":"post","link":"https:\/\/www.experfy.com\/blog\/software-ux-ui\/ajax-and-javascript-with-examples\/","title":{"rendered":"AJAX and JavaScript with examples"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"9150\" class=\"elementor elementor-9150\" data-elementor-post-type=\"post\">\n\t\t\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-4a3aae8b elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"4a3aae8b\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-3cbb534d\" data-id=\"3cbb534d\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-21b21d75 elementor-widget elementor-widget-text-editor\" data-id=\"21b21d75\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Ajax stands for \u201cAsynchronous JavaScript + XML\u201d (although JSON is mostly used today) and is a group of technologies designed to dynamically create web pages. By using AJAX we improve the quality of interactivity with the user, with the desire to resemble desktop applications as much as possible (according to the speed of interaction). The idea behind Ajax is to load the webpage of the Web application only once, and that any further communication with the server is done asynchronously without blocking the interface and without reloading the entire page.<\/p>\n<!-- \/wp:paragraph -->\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f2e8c07 elementor-widget elementor-widget-text-editor\" data-id=\"f2e8c07\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Asynchronous behavior means that after the user interacts with the interface, the request to the server accepts a JavaScript and XMLHttpRequest object, which in the background sends requests to the server, displaying the results when available, while the user can continue working in the meantime.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>Ajax is not without flaws, as Ajax pages dynamically generate the biggest problem for sites is search engine optimization. Search engines are often unable to interpret the site well, causing problems with site indexing. A similar problem exists with Page Traffic Analysis Tools, as a user can spend all day on a single Ajax page, and classic traffic analysis tools will interpret this as a single pageview.<\/p>\n<!-- \/wp:paragraph -->\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-d3ca425 elementor-widget elementor-widget-heading\" data-id=\"d3ca425\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\"><h2>XMLHttpRequest object<\/h2><\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-8b6f54a elementor-widget elementor-widget-text-editor\" data-id=\"8b6f54a\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>XMLHttpRequest is the foundation of AJAX and is a JavaScript object used to send HTTP requests. Designed by Microsoft and then accepted by other major search engines and in 2014 it became standard in W3C.<\/p>\n<!-- \/wp:paragraph -->\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-aa41dfe elementor-widget elementor-widget-heading\" data-id=\"aa41dfe\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\"><h2>XHR object properties<\/h2><\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-442884c elementor-widget elementor-widget-text-editor\" data-id=\"442884c\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<!-- wp:paragraph -->\n<p><strong>readyState<\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>The numerical value that describes the state of an object The possible states are: 0, 1, 2, 3 and 4<br \/>state 0: The initial value of the object after creation<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><ins><\/ins><br \/>state 1: open () method successfully executed; request headsets can be set at this stage with the setRequestHeader () function<br \/>state 2: all response heads have arrived<br \/>condition 3: starts reading the answer data part<br \/>condition 4: The response data part was loaded successfully or an error occurred<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><strong>responsType<\/strong><\/p>\n<!-- \/wp:paragraph -->\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-c1d7c45 elementor-widget elementor-widget-text-editor\" data-id=\"c1d7c45\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<!-- wp:paragraph -->\n<p>The text data corresponding to the type of server response the possible values are: \u201c\u201d, \u201carraybuffer\u201d, \u201cblob\u201d, \u201cdocument\u201d, \u201cjson\u201d and \u201ctext\u201d<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><strong>response<\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>A property that accesses the server\u2019s response body<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><strong>responseText<\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>Returns the server response as a string<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><strong>responseXML<\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>Returns the server response as XML data<\/p>\n<!-- \/wp:paragraph -->\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-0c011b1 elementor-widget elementor-widget-text-editor\" data-id=\"0c011b1\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<!-- wp:paragraph -->\n<p><strong>status<\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>A numeric value that corresponds to the HTTP hour of the server response. We are most interested in status 200 \u2013 an indication that the request has been successfully processed<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><strong>statusText<\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>A text message that responds to an HTTP response server message (e.g., \u201cNot Found\u201d or \u201cOK\u201d)<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><strong>timeout<\/strong><\/p>\n<!-- \/wp:paragraph -->\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-bb0782e elementor-widget elementor-widget-text-editor\" data-id=\"bb0782e\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<!-- wp:paragraph -->\n<p>The numeric value after which the HTTP request will end; the timeout value should be slightly higher than the time provided for response generation; the responseText property value will then be null<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><strong>withCredentials<\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>A Boolean value that defines whether cross-site Access-Control requires credentials such as cookies, an authorized header, or a TLS certificate.<\/p>\n<!-- \/wp:paragraph -->\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-cff104f elementor-widget elementor-widget-heading\" data-id=\"cff104f\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\"><h2>XHR object methods<\/h2><\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-79dab41 elementor-widget elementor-widget-text-editor\" data-id=\"79dab41\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<!-- wp:paragraph -->\n<p><strong>abort ()<\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>Cancels the current request<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><strong>getAllResponseHeaders ()<\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>Returns all header information<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><strong>getResponseHeader ()<\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>Returns specific header information<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><strong>open (method, url, async, uname, PSWD)<\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>The function that initiates the HTTP request and the parameters it accepts are:<br \/>Method: POST, GET, HEADER, ROAD, DELETE<br \/>URL is the URL of the requesting server<br \/>Asynchrony can be true or false depending on whether the request realizes asynchronous or synchronous<br \/>Username and password are optional arguments that are specified if needed to access the server<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><strong>send ()<\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>The method by which data is sent to the server (if we have something to send)<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><strong>setRequestHeader (header, value)<\/strong><\/p>\n<!-- \/wp:paragraph -->\n<!-- wp:paragraph -->\n<p>Adds a label\/value pair in the header when sending data. It must be called after the open () method and before the send () method<\/p>\n<!-- \/wp:paragraph -->\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-775f4b8 elementor-widget elementor-widget-heading\" data-id=\"775f4b8\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\"><h2>Procedure<\/h2><\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-300f087 elementor-widget elementor-widget-text-editor\" data-id=\"300f087\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<!-- wp:paragraph -->\n<p><strong>a) Creating an object<\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>It is created by invoking the XMLHttpRequest constructor:<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:code -->\n<pre class=\"wp-block-code\"><code>var xhr = new XMLHttpRequest();<\/code><\/pre>\n<!-- \/wp:code -->\n\n<!-- wp:paragraph -->\n<p><strong>b) Event handler and a callback function<\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><strong>onreadystatechange<\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>This mode is the oldest and is supported in all browsers. EventHandler monitors every readyState and triggers every state change.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:code -->\n<pre class=\"wp-block-code\"><code>xhr.onreadystatechange = function(){\n    if (this.readyState == 4 &amp;&amp; this.status == 200) {\n       \/\/ Process the server response here.\n    }\n};<\/code><\/pre>\n<!-- \/wp:code -->\n\n<!-- wp:paragraph -->\n<p><strong>loadstart<\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>The process started \u2013 Once \u2013 First<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><strong>progress<\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>Process in progress \u2013 zero or higher \u2013 When the loadstart is complete.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><strong>error<\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>With this eventListener, we listen to network-level errors:<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:code -->\n<pre class=\"wp-block-code\"><code>xhr.addEventListener(error, function(e) {\n  var error = e.error;\n  console.log(error);\n  });<\/code><\/pre>\n<!-- \/wp:code -->\n\n<!-- wp:paragraph -->\n<p><strong>abort<\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>The process is interrupted. \u2013 Once or not<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><strong>load<\/strong><\/p>\n<!-- \/wp:paragraph -->\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f8a6077 elementor-widget elementor-widget-text-editor\" data-id=\"f8a6077\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<!-- wp:paragraph -->\n<p>onreadystatechange \u201ctriggers\u201d an event at every change of state of an object, however, we are usually only interested when the state of an object changes to a value: readyState == 4. If you do not care about information about other states and want to reduce the \u201ctrigger\u201d of unnecessary events, it may be better newer and more modern approach when only one load event is generated when the server responds:<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:code -->\n<pre class=\"wp-block-code\"><code>xhr.addEventListener(\"load\", function(){\n    if (this.status &lt; 400) {\n      \/\/ Process the server response here.\n    } else {\n      new Error(\"Request failed: \" + xhr.statusText);\n}, false);<\/code><\/pre>\n<!-- \/wp:code -->\n\n<!-- wp:paragraph -->\n<p><strong>loadend<\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>The entire process is completed \u2013 Once \u2013 Activated after some error, deliberate abortion or when the load is completed successfully.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><strong>c) Defining Connection Parameters<\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>After creating the XMLHttpRequest object, it is necessary to define the basic parameters for communication. This method does not send the request to the webserver but saves its arguments for sending the request later.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:code -->\n<pre class=\"wp-block-code\"><code>xhr.open(method,url,async,username,password)<\/code><\/pre>\n<!-- \/wp:code -->\n\n<!-- wp:paragraph -->\n<p>Description of method arguments:<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>Method<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>The methods that can be used are\u00a0<strong>POST, GET, HEADER, PUT, DELETE.<\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>The\u00a0<strong>GET\u00a0<\/strong>method sends the request and data through the URL, the request can be cached, the request remains in the browser history and can be bookmarked. The disadvantage is the limited amount of data that can be passed through the URL, as well as the visibility of the data in the URL (read \u201cinsecurity\u201d). This is why this method is not used to send important data.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>The\u00a0<strong>POST\u00a0<\/strong>method does not send data through a URL but through the send () attribute of the method, so it is more secure and is used when sending confidential information (usually user-entered). The\u00a0<strong>POST\u00a0<\/strong>method is also used when it is necessary to send a larger amount of data with the consideration that it does not have a limited data size, as is the case with the\u00a0<strong>GET\u00a0<\/strong>method. However, with this method, the request cannot be cached, it does not remain in browser history, nor can it be bookmarked.<br \/>The\u00a0<strong>HEAD\u00a0<\/strong>method requests the header server from the specified\u00a0<strong>URL\u00a0<\/strong>without the contents of the document (used, for example, to check the date of change of resources).<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><strong>URL<\/strong><br \/>URL is the URL of the requesting server<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><strong>Asynchrony requires<br \/><\/strong>This parameter defines the asynchrony of the request. It can be true or false. If omitted or defined as TRUE then the request is asynchronous.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><em><strong>REMARK:<\/strong><\/em><strong><em><br \/>The XMLHttpRequest request may also be synchronous, but it is not recommended because if the north does not send a response, the send () method may block the browser. There is no \u201cmagic button\u201d that stops XMLHttpRequest, no maximum waiting time, so the JavaScript engine does not allow the request to be stopped once sent.<\/em><\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><strong>User Name and Password<br \/><\/strong>Username and password are optional arguments that are specified if needed to access the server<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><strong>d) Defining header information<\/strong><\/p>\n<!-- \/wp:paragraph -->\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-c890260 elementor-widget elementor-widget-text-editor\" data-id=\"c890260\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<!-- wp:paragraph -->\n<p><strong>Syntax<\/strong><br \/>With the setRequestHeader () method, we can define some values in the request header. It is most commonly used when sending data to a server using the POST method. The method parameter is in the form of a key, value pair.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:code -->\n<pre class=\"wp-block-code\"><code>xhr.setRequestHeader(key, value);<\/code><\/pre>\n<!-- \/wp:code -->\n\n<!-- wp:paragraph -->\n<p><strong><em>REMARK:<br \/>The setRequestHeader () method must be located between the open () and send () methods.<\/em><\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><strong>Use<\/strong><br \/>Most often, the parameter of the \u201csetRequestHeader ()\u201d method sends data in which way the encoded data is sent.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:code -->\n<pre class=\"wp-block-code\"><code>xhr.setRequestHeader(\"Content-type\", \"application\/x-www-form-urlencoded\");<\/code><\/pre>\n<!-- \/wp:code -->\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-09a6827 elementor-widget elementor-widget-text-editor\" data-id=\"09a6827\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<!-- wp:paragraph -->\n<p><strong>What is encoding?<br \/><\/strong>There are three ways that it can be encoded:<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><strong>application\/x-www-form-urlencoded<\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>By default, all characters are encoded before sending (spaces are converted to \u201c+\u201d symbols, and special characters are converted to ASCII HEX values. Actually, a query string consisting of name\/value pairs separated by \u201c&amp;\u201d, where names separated by values are equal to \u201c=\u201d if there are special characters, they are transferred to ASCII HEX values.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><strong>multipart\/form-data<\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>No characters are encoded. This value is required when using templates with control to upload files<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><strong>text\/plain<\/strong><\/p>\n<!-- \/wp:paragraph -->\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-fee7d87 elementor-widget elementor-widget-text-editor\" data-id=\"fee7d87\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<!-- wp:paragraph -->\n<p>Spaces are converted to \u201c+\u201d symbols, but there are no other special characters<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>The content-type \u201capplication \/ x-www-form-urlencoded\u201d is used in most cases, except for sending large amounts of binary data or text containing non-ASCII characters because it is inefficient for this purpose. And \u201cmultipart \/ form-data\u201d should be used to submit forms containing files, non-ASCII data, and binary data.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><strong>e) Preparing data for submission<\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>In the case of sending data, it is necessary to prepare the data in a format that is suitable for sending.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><strong>Serializing data in query string<\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><strong>a) Simple information<\/strong><\/p>\n<!-- \/wp:paragraph -->\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-62b6bb1 elementor-widget elementor-widget-text-editor\" data-id=\"62b6bb1\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<!-- wp:paragraph -->\n<p>If the data is simple, it is sent as a query string consisting of name\/value pairs separated by the character \u201c&amp;\u201d, where the names are separated from the value by a character equal to \u201c=\u201d, and if there are special characters they are transferred to ASCII HEX values.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:code -->\n<pre class=\"wp-block-code\"><code>var data = \"MyVariableOne=ValueOne&amp;MyVariableTwo=ValueTwo\";<\/code><\/pre>\n<!-- \/wp:code -->\n\n<!-- wp:paragraph -->\n<p><strong>b) Object<\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>If it is a JSON object, it must first be moved to a string.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:code -->\n<pre class=\"wp-block-code\"><code>var arr = JSON.stringify([ 'foo', 'bar' ]);  \/\/ Returns: [\"foo\",\"bar\"]<\/code><\/pre>\n<!-- \/wp:code -->\n\n<!-- wp:paragraph -->\n<p>Then encode the resulting string:<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:code -->\n<pre class=\"wp-block-code\"><code>var encoArr = encodeURIComponent(arr)  \/\/ Returns: %5B%22foo%22%2C%22bar%22%5D\nvar url = 'http:\/\/example.com\/?data=' + encoArr ;<\/code><\/pre>\n<!-- \/wp:code -->\n\n<!-- wp:paragraph -->\n<p>You can check decoding and encoding through online services such as\u00a0<a href=\"https:\/\/www.freeformatter.com\/url-encoder.html\" rel=\"noopener\">https:\/\/www.freeformatter.com\/url-encoder.html<\/a>\u00a0or\u00a0<a href=\"http:\/\/www.url-encode-decode.com\/\" rel=\"noopener\">http:\/\/www.url-encode-decode.com\/<\/a>.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><strong>Example<\/strong><br \/>This snippet has similar functionality to the jQuery serialize () method<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:code -->\n<pre class=\"wp-block-code\"><code>function serialize(form) {\n    var field, l, s = [];\n    if (typeof form == 'object' &amp;&amp; form.nodeName == \"FORM\") {\n        var len = form.elements.length;\n        for (var i=0; i&lt;len; i++) {\n            field = form.elements[i];\n            if (field.name &amp;&amp; !field.disabled &amp;&amp; field.type != 'file' &amp;&amp; field.type != 'reset' &amp;&amp; field.type != 'submit' &amp;&amp; field.type != 'button') {\n                if (field.type == 'select-multiple') {\n                    l = form.elements[i].options.length;\n                    for (var j=0; j&lt;l; j++) {\n                        if(field.options[j].selected)\n                            s[s.length] = encodeURIComponent(field.name) + \"=\" + encodeURIComponent(field.options[j].value);\n                    }\n                } else if ((field.type != 'checkbox' &amp;&amp; field.type != 'radio') || field.checked) {\n                    s[s.length] = encodeURIComponent(field.name) + \"=\" + encodeURIComponent(field.value);\n                }\n            }\n        }\n    }\n    return s.join('&amp;').replace(\/%20\/g, '+');\n}<\/code><\/pre>\n<!-- \/wp:code -->\n\n<!-- wp:paragraph -->\n<p><strong>Serialize data into a series<br \/><\/strong>This snippet has similar functionality to the jQuery serializeArray () method<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:code -->\n<pre class=\"wp-block-code\"><code>function serializeArray(form) {\n    var field, l, s = [];\n    if (typeof form == 'object' &amp;&amp; form.nodeName == \"FORM\") {\n        var len = form.elements.length;\n        for (var i=0; i&lt;len; i++) {\n            field = form.elements[i];\n            if (field.name &amp;&amp; !field.disabled &amp;&amp; field.type != 'file' &amp;&amp; field.type != 'reset' &amp;&amp; field.type != 'submit' &amp;&amp; field.type != 'button') {\n                if (field.type == 'select-multiple') {\n                    l = form.elements[i].options.length;\n                    for (j=0; j&lt;l; j++) {\n                        if(field.options[j].selected)\n                            s[s.length] = { name: field.name, value: field.options[j].value };\n                    }\n                } else if ((field.type != 'checkbox' &amp;&amp; field.type != 'radio') || field.checked) {\n                    s[s.length] = { name: field.name, value: field.value };\n                }\n            }\n        }\n    }\n    return s;\n}<\/code><\/pre>\n<!-- \/wp:code -->\n\n<!-- wp:paragraph -->\n<p><strong>f) Submit request<\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>The initiation of connecting a prepared and defined request to the server is done with the send () method. We can use the send method attribute to pass data to the server. Exactly with the POST method, this is the main principle of sending data. We simply send all the \u201cpreparation\u201d data as an attribute of the \u201csend\u201d method. However, since the GET method sends all information through a URL, then we do not use this option to send it through an attribute, but instead, define the attribute with a null send (null) or simply not fill it.<\/p>\n<!-- \/wp:paragraph -->\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-9c459fd elementor-widget elementor-widget-text-editor\" data-id=\"9c459fd\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<!-- wp:paragraph -->\n<p><strong>g) Server response<\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><strong>The status of the request<\/strong><br \/>The status of our request as a server response is accessed using the XMLHttpRequest property of the status object<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:code -->\n<pre class=\"wp-block-code\"><code>xhr.status<\/code><\/pre>\n<!-- \/wp:code -->\n\n<!-- wp:paragraph -->\n<p>and status text with:<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:code -->\n<pre class=\"wp-block-code\"><code>xhr.statusText<\/code><\/pre>\n<!-- \/wp:code -->\n\n<!-- wp:paragraph -->\n<p><strong>String answer<br \/><\/strong>The server response in the form of a \u201cstring string\u201d is accessed via the responseText property<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:code -->\n<pre class=\"wp-block-code\"><code>xhr.responseText<\/code><\/pre>\n<!-- \/wp:code -->\n\n<!-- wp:paragraph -->\n<p><strong><em>REMARK:<br \/>XMLHttpRequest does not have a direct response server property in JSON format, so it is necessary to parse the response:<br \/>JSON.parse (xhr.responseText);<\/em><\/strong><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-7ee7070 elementor-widget elementor-widget-text-editor\" data-id=\"7ee7070\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<!-- wp:paragraph -->\n<p><strong>XML response<\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>The server response that is some XML is accessed with responseXML<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:code -->\n<pre class=\"wp-block-code\"><code>xhr.responseXML<\/code><\/pre>\n<!-- \/wp:code -->\n\n<!-- wp:paragraph -->\n<p><strong>HTTP response server header<\/strong><br \/>Access to all headers returned by the webserver is via the getResponseHeader () method:<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:code -->\n<pre class=\"wp-block-code\"><code>xhr.getResponseHeader()<\/code><\/pre>\n<!-- \/wp:code -->\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-52ad356 elementor-widget elementor-widget-heading\" data-id=\"52ad356\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\"><h2>Examples<\/h2><\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-533896f elementor-widget elementor-widget-text-editor\" data-id=\"533896f\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<!-- wp:paragraph -->\n<p><strong><em>EXPLANATION:<br \/>In the examples, I use the online resource myjson.com to quickly generate REST endpoints.<\/em><\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><strong>a) Getting data from the server<\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><strong>Example No.1<\/strong><br \/>I access the JSON file saved at\u00a0<a href=\"http:\/\/myjson.com\/\" class=\"broken_link\" rel=\"noopener\">http:\/\/myjson.com\/<\/a>\u00a0through endpoint:\u00a0<a href=\"https:\/\/api.myjson.com\/bins\/erxi9\" class=\"broken_link\" rel=\"noopener\">https:\/\/api.myjson.com\/bins\/erxi9<\/a>. With ajax request towards the endpoint, I get the following content:<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:code -->\n<pre class=\"wp-block-code\"><code>[\n    {\n    name: \"Alen\",\n    position: \"CEO\"\n    },\n    {\n    name: \"John\",\n    position: \"Director\"\n    },\n    {\n    name: \"Mark\",\n    position: \"Worker\"\n    },\n    {\n    name: \"Hasan\",\n    position: \"Worker\"\n    },\n    {\n    name: \"Deen\",\n    position: \"Worker\"\n    }\n]<\/code><\/pre>\n<!-- \/wp:code -->\n\n<!-- wp:paragraph -->\n<p>This example shows all persons who satisfy the chosen position:<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><strong>HTML<\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:code -->\n<pre class=\"wp-block-code\"><code>&lt;label for=\"position\"&gt;Select Position&lt;\/label&gt;\n&lt;select id=\"position\"&gt;\n  &lt;option value=\"ceo\"&gt;CEO&lt;\/option&gt;\n  &lt;option value=\"director\"&gt;Director&lt;\/option&gt;\n  &lt;option value=\"worker\"&gt;Worker&lt;\/option&gt;\n&lt;\/select&gt;\n&lt;br&gt;&lt;br&gt;&lt;br&gt;\n&lt;div id=\"btn1\" class=\"btn\"&gt;Get data from server&lt;\/div&gt;\n&lt;div id=\"output\"&gt;&lt;\/div&gt;<\/code><\/pre>\n<!-- \/wp:code -->\n\n<!-- wp:paragraph -->\n<p><strong>SCSS<\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:code -->\n<pre class=\"wp-block-code\"><code>.btn {\n  border: 1px solid black;\n  padding: 8px;\n  display: inline-block;\n  background-color:red;\n  color:white;\n  margine: 0 auto;\n  display: block;\n  text-align:center;\n  cursor: pointer;\n  \n}\n#output {\n  font-size: 24px;\n  padding: 15px;\n  text-align: center;\n}<\/code><\/pre>\n<!-- \/wp:code -->\n\n<!-- wp:paragraph -->\n<p><strong>Babel<\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:code -->\n<pre class=\"wp-block-code\"><code>var output = document.getElementById(\"output\");\nvar btn = document.getElementById(\"btn1\");\nvar select = document.getElementById(\"position\");\n\n\/* the part where the selected option from the dropdown is stored *\/\nvar selectPosition= \"director\";\nselect.addEventListener(\"change\", function(){\n  selectPosition= select.options[select.selectedIndex].value;\n}) \t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f8870ff elementor-widget elementor-widget-text-editor\" data-id=\"f8870ff\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<!-- wp:code -->\n<pre class=\"wp-block-code\"><code>var output = document.getElementById(\"output\");\nvar btn = document.getElementById(\"btn1\");\nvar select = document.getElementById(\"position\");\n\n\/* the part where the selected option from the dropdown is stored *\/\nvar selectPosition= \"director\";\nselect.addEventListener(\"change\", function(){\n  selectPosition= select.options[select.selectedIndex].value;\n}) \n\n\/* Event handler on the button *\/\nbtn.addEventListener(\"click\", function() {\n  \/* Cleaning the screen *\/\n  output.innerHTML=\"\";\n  \/* New XMLHttpRequest object *\/\n  var httpRequest = new XMLHttpRequest();\n  \/* EventHandler for ajax request *\/\n  httpRequest.addEventListener(\"load\", function(){\n    if (this.status &lt; 400) {\n      \/* Data obtained by ajax *\/\n      var myObj = JSON.parse(this.responseText);\n      \/* Print only selected positions *\/\n      var SelectArray= myObj.filter(function (obj) {\n          return obj.position== selectPosition;    \n      });\n       for (let select in SelectArray) {\n          output.innerHTML += SelectArray[select].position + \" \" + SelectArray[select].name+ \"&lt;br&gt;\";\n      }\n    } else {\n      var errors= new Error(\"Request failed: \" + httpRequest.statusText);\n      console.log(\"Server is OK but some transport error\");\n    }\n  }, false);\n  \/* Opening a connection and defining parameters *\/\n  httpRequest.open(\"GET\", \"https:\/\/api.myjson.com\/bins\/erxi9\", true);\n  httpRequest.send();\n}, false )<\/code><\/pre>\n<!-- \/wp:code -->\n\n<!-- wp:paragraph -->\n<p><strong>Example No.2<\/strong><br \/>For this example, I use the generated endpoint\u00a0<a href=\"https:\/\/api.myjson.com\/bins\/amz5t\" class=\"broken_link\" rel=\"noopener\">https:\/\/api.myjson.com\/bins\/amz5t<\/a>.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:code -->\n<pre class=\"wp-block-code\"><code>&lt;p&gt;(Titles obtained by AJAX)&lt;\/p&gt;\n&lt;h1 id=\"title\"&gt;&lt;\/h1&gt;\n&lt;h3 id=\"description\"&gt;&lt;\/h3&gt;\n&lt;hr&gt;\n&lt;div&gt;\n  &lt;p&gt;(Links to articles were provided by AJAX)&lt;\/p&gt; \n  &lt;div id=\"text\"&gt;&lt;\/div&gt;\n&lt;\/div&gt;<\/code><\/pre>\n<!-- \/wp:code -->\n\n<!-- wp:paragraph -->\n<p><strong>TypeScript<\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:code -->\n<pre class=\"wp-block-code\"><code>function ajax_get(url, callback) {\n    var xmlhttp = new XMLHttpRequest();\n    xmlhttp.onreadystatechange = function() {\n        if (xmlhttp.readyState == 4 &amp;&amp; xmlhttp.status == 200) {\n            try {\n                var data = JSON.parse(xmlhttp.responseText);\n            } catch(err) {\n                console.log(err.message + \" in \" + xmlhttp.responseText);\n                return;\n            }\n            callback(data); \n        }\n    };\n    xmlhttp.open(\"GET\", url, true);\n    xmlhttp.send();\n}\n\najax_get('https:\/\/api.myjson.com\/bins\/amz5t', function(data){\n  var eNaslov = document.getElementById(\"title\");\n  var eOpis = document.getElementById(\"description\");\n  var eArtikli = document.getElementById(\"text\");\n  var serverArtikli = '';\n  serverArtikli += \"&lt;ul&gt;\";\n  for (var i=0; i &lt; data[\"articles\"].length; i++) {\n    serverArtikli += '&lt;li&gt;&lt;a href=\"' + data[\"articles\"][i][\"url\"] + '\"&gt;' + data[\"articles\"][i][\"title\"] + \"&lt;\/a&gt;&lt;\/li&gt;\";\n  }\n  serverArtikli += \"&lt;\/ul&gt;\";\n  \n  eNaslov.innerHTML = data[\"title\"]; \/\/\n  eOpis.innerHTML = data[\"description\"];\n  eArtikli.innerHTML = serverArtikli;\n})<\/code><\/pre>\n<!-- \/wp:code -->\n\n<!-- wp:paragraph -->\n<p><strong>b) Uploading data to the server<\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><strong>Example<\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:code -->\n<pre class=\"wp-block-code\"><code>var newName = 'John Smith';\nvar xhr = new XMLHttpRequest();\n \nxhr.open('POST', 'myservice\/username?id=some-unique-id');\nxhr.setRequestHeader('Content-Type', 'application\/x-www-form-urlencoded');\nxhr.onload = function() {\n    if (xhr.status === 200 &amp;&amp; xhr.responseText !== newName) {\n        alert('Something went wrong.  Name is now ' + xhr.responseText);\n    }\n    else if (xhr.status !== 200) {\n        alert('Request failed.  Returned status of ' + xhr.status);\n    }\n};\nxhr.send(encodeURI('name=' + newName));<\/code><\/pre>\n<!-- \/wp:code -->\n\n<!-- wp:paragraph -->\n<p><strong>Example: submitting form information<\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:code -->\n<pre class=\"wp-block-code\"><code>document.getElementById(\"myform\").onsubmit = function(e) {\n   e.preventDefault();\n   var f = e.target,\n       formData = '',\n       xhr = new XMLHttpRequest();\n   \/\/ fetch form values\n   for (var i = 0, d, v; i &lt; f.elements.length; i++) {\n       d = f.elements[i];\n       if (d.name &amp;&amp; d.value) {\n           v = (d.type == \"checkbox\" || d.type == \"radio\" ? (d.checked ? d.value : '') : d.value);\n           if (v) formData += d.name + \"=\" + escape(v) + \"&amp;\";\n       }\n   }\n   xhr.open(\"POST\", f.action);\n   xhr.setRequestHeader(\"Content-Type\",\"application\/x-www-form-urlencoded; charset=UTF-8\");\n   xhr.send(formData);\n}<\/code><\/pre>\n<!-- \/wp:code -->\n\n<!-- wp:paragraph -->\n<p><strong>c) Uploading files to the server<\/strong><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:code -->\n<pre class=\"wp-block-code\"><code>var file = document.getElementById('test-input').files[0];\nvar xhr = new XMLHttpRequest();\nxhr.open('POST', 'myserver\/uploads');\nxhr.setRequestHeader('Content-Type', file.type);\nxhr.send(file);<\/code><\/pre>\n<!-- \/wp:code -->\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Ajax stands for \u201cAsynchronous JavaScript + XML\u201d and is a group of technologies designed to dynamically create web pages. By using AJAX we improve the quality of interactivity with the user, with the desire to resemble desktop applications as much as possible <\/p>\n","protected":false},"author":685,"featured_media":14487,"comment_status":"open","ping_status":"open","sticky":false,"template":"single-post-2.php","format":"standard","meta":{"content-type":"","footnotes":""},"categories":[200],"tags":[499,424,500],"ppma_author":[3475],"class_list":["post-9150","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software-ux-ui","tag-ajax","tag-javascript","tag-xml"],"authors":[{"term_id":3475,"user_id":685,"is_guest":0,"slug":"alen-ibric","display_name":"Alen \u0130bri\u00e7","avatar_url":"https:\/\/www.experfy.com\/blog\/wp-content\/uploads\/2020\/04\/medium_7b9fc7fb-1f17-4554-9f19-b942b50e055c-150x150.jpg","user_url":"http:\/\/www.bilkent.edu.tr\/","last_name":"\u0130bri\u00e7","first_name":"Alen","job_title":"","description":"<a href=\"http:\/\/alenibric.com.tr\/\">Alen \u0130bri\u00e7<\/a> is Senior Computer Engineer at Bilkent University, Turkey."}],"_links":{"self":[{"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/posts\/9150","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/users\/685"}],"replies":[{"embeddable":true,"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/comments?post=9150"}],"version-history":[{"count":5,"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/posts\/9150\/revisions"}],"predecessor-version":[{"id":34349,"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/posts\/9150\/revisions\/34349"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/media\/14487"}],"wp:attachment":[{"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/media?parent=9150"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/categories?post=9150"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/tags?post=9150"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=9150"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}