DONATE  
MENU
HTML
JAVASCRIPT
AJAX
JSON

AJAX Tutorials

JAVASCRIPT AJAX

» Introduction

» HTTP Request Object

» AJAX Example

» AJAX GET Request

» AJAX POST Request

.. » AJAX » Javascript Ajax » Introduction
Share Tweet WhatsApp

Introduction

AJAX stands for Asynchronous JavaScript And XML. it is a technology that enables a webpage to communicate with a file on its server without the webpage reloading or the web user noticing. A server is a computer or device where your website lives. If your webpage or website is on your personal computer, then your PC is the server. If it is on your phone, that is also the server. All websites are hosted on a server or computer. With JavaScript AJAX, we can open just any file on a webpage server, get the content of such files and display same on our webpage. AJAX is not a programming language neither is it a JavaScript framework. It is basically a JavaScript Object with few but powerful properties and methods that can be used in communicating with a website's server. The AJAX Object is supported on all modern browsers. What You Can Do With AJAX With JavaScript AJAX, you can do a whole lot that can make your website not just interactive but dynamic. In summary, you can:
  • Send a request to a file on a webpage server without the webpage reloading.
  • Get the content of such files or documents.
  • Use the content to update your webpage dynamically without the webpage reloading.
  • Send request to files to run server side codes without the webpage reloading. For example, assuming PHP is installed on your server, you can therefore send requests to PHP files and have them run queries to perform whatever operations on your server and database.
Just as the full meaning of the name "AJAX" may suggest, the technology was originally designed to help get contents of XML (eXtensive Markup Language) documents but today, AJAX can practically be used in sending request to whatever kind of document e.g XML, TEXT, PHP, HTML, CSS, JS files and etcetera. AJAX In Practice Example Here are some cases of how websites are using AJAX to build not just interactive but dynamic webpages.
  • Have you ever tried doing a Google search and then, as you type in your search query, Google returns suggestions stored in its servers? That's AJAX.
  • Have you ever visited Facebook on a modern browser and you find out you can do a lot of things involving database operations without the Facebook page reloading e.g liking/disliking a post? That's what AJAX can help you achieve.
  • Let's come home to stackbeginner.com. Have you ever tried searching for contents here and then, as you type in your query, pages related to your query are being returned from our database? That is AJAX.
  • Our "TEST YOURSELF" QUIZ and commenting systems have AJAX as their backbone.
Therefore, AJAX is a technology you must learn to use as a modern day JavaScript developer. HOW AJAX WORKS Below is how AJAX requests are usually implemented on a webpage.
  1. An event happens on a webpage. For example, a user clicks on a button to submit some requested information.
  2. A function is called to handle that event.
  3. Inside the function, an AJAX or HTTP request Object is created.
  4. Methods and properties of the Object are implemented to send the request to a particular file or document on a server.
  5. Request sent. Server returns responses (Good or bad responses).
  6. if response is good. That is, successful, we get whatever text or data (if any) returned by the server from that document.
  7. We display the data or text if need be.
In this chapter, you will learn all properties and methods that will enable you send HTTP or AJAX requests. SUMMARY
  1. AJAX stands for asynchronous JavaScript and XML.
  2. AJAX can simply be seen as sending requests to files contained on a web page's server without the webpage reloading or a user noticing.
  3. We send such requests to either get whatever is the content of such files or documents or to execute server codes contained in such files.
  4. AJAX requests are sent using the HTTP request Object, a JavaScript Object that is supported by all modern browsers.
  5. As an Object, there exist properties and methods that help us fully achieve our aim.
  6. You can only send requests to files on your server. You can't send to other websites' servers for security reasons.
  7. You will learn all you need to start sending AJAX requests to your server in this chapter.
Take a short quiz on Introduction.
Ask a question or tell us if Introduction is easy or not.
cent?

Join our 1,090 subscribers to receive tutorials' updates!

  We won't spam your mail box. We hate it.





StackBeginner 2021 © Joseph Omamode