JustPaste.it

Learn In Simple Way with example What Is AJAX

User avatar
Aashutosh Kumar Yadav @infotokri · Aug 6, 2022 · edited: Aug 7, 2022

Ajax is a powerful tool for website development that can be used to display data, create menus, lists, and elements on pages, and add content to websites. You can update or load the page data without page refreshing due to the use of Ajax on the page  - the best feature of Ajax.

 

Learn in simple way with example what is ajax

 

What is Ajax?
Ajax is a web technology that helps developers write code in a more efficient and concise manner. Ajax is used to make web pages, applications, and other web-based systems run faster and smoother.

Ajax is said to have many advantages over traditional programming languages like PHP or Java when it comes to developing websites or applications. Almost every browser and operating system support Ajax functionality.

Browsers that are Ajax supported include Firefox, Chrome, Safari, Opera, and IE. Operating systems that are Ajax supported include Windows, Mac OS, Android, and iOS. Devices that are Ajax supported include a computer or phone with an internet connection and an HTML5 capable browser.

What are the different types of Ajax?
Ajax is divided mainly into the following three types on the basis of action involvement -

  1. Event-driven Ajax -
    Event-driven Ajax allows you to create programs that work without any input from the user—you just need events to happen!
  2. Script-driven Ajax -
    Script-driven Ajax takes advantage of scripts (files that contain code that can be executed) to speed up development by allowing you to programmatically control how your code runs.
  3. Stateless Ajax -
    Stateless Ajax doesn’t rely on any external resources (like data) in order to function, which can save you time when building large applications or websites.

What are the features of Ajax?
Ajax has several features that make it an advantageous tool for developers -

  • Fast loading technology -
    When using Ajax, your pages or applications will run much faster than with traditional programming languages.
  • Absolutely concise code format -
    With Ajax, developers can write code in a more concise and organized manner, making it easier to understand and maintain their projects.
  • Very easy to use -
    It is very easy to use in the application. While most developers benefit from using Ajax, there are a few basics you must know in order to get started with it effectively.

How to use Ajax?
AJAX is a programming language that enables Web pages to interact with each other using Ajax calls. This means that you can call functions on individual web pages, without having to write entire code blocks for each page interaction.

The most common actions done with Ajax are displaying data (e.g., listing items in a list), creating menus, and adding elements to a page. You can view the live demonstration of the data listing on the page without refreshing How to show MySQL PHP data list via jQuery AJAX to get real experience of Ajax with PHP scripting language.

You can also do a live example of AJAX by opening the google.com site in your browser. You need to type any keyword or search terms into the search box of the google.com page. Google's internal Ajax action will show you a list of keyword suggestions based on the keywords typed. This is the best example of Ajax which is also shown to you in the screenshot below. 

 

Ajax real example - Google search auto complete feauture

 

 

In the above screenshot, we have taken the "flower pots" keyword for example. You can say that "Ajax is known for updating or fetching data on a page without refreshing" after viewing the above screenshot.

 

Source: infotokri