In the article we published yesterday, we talked in full about Ajax. Today we want to look at some things you may not have heard of before.
What does AJAX do?
Normally, when there is no Ajax, for example, when a form is filled out by a user and the submit button is clicked, the information is transferred to the server in a specific format and then the server response is sent back to the front; The result is a user redirecting to a new page or refreshing the entire page.
In fact, Ajax separates the data exchange phase between Front and Back from the phase displayed on the Front. As a result, a web page can modify content without having to reload the entire page and its contents.
AJAX uses the following technologies for the specified purposes:
- XMLHttpRequest object: To exchange data asynchronously with the server,
- CSS: For visual beauty of the display,
- XML: Data transfer format.
Of course, as we know, we are dealing with a concept that belongs to the world of web development and web design. So other than generalities and definitions, not much can be written to give a clear picture of what should actually happen when coding for a page or web.
Examples of AJAX applications
For example, imagine a page on a website where users of that website can comment. Imagine 200 comments left so far . Of course, it is not possible to display all of those comments on the page.
What happens if someone wants to see previous comments? Previous comments must be loaded. That is, the user sits in front of the monitor and looks at the page to load previous comments.
But if Ajax was used in the design of that website and for the comments section, there is no need to listen to the previous comments. As soon as the “More Comments” option is clicked, more comments will be displayed.
Popular web applications such as Gmail, Google Maps, Youtube & Facebook, which we visit every day, use the Ajax technique.
In Gmail, you do not need to refresh the page to see new emails.
In Google Maps, when you drag the map in different directions; There is no news of refreshing the whole page. It looks like the whole map is ready.
Another popular example of using Ajax is Auto-complete in Google Suggest. You will see the same thing whenever you search for a word in Google.
In addition to the examples we mentioned, the AJAX technique is generally used for the Login forms and Rating and Voting pages.
Tweeter also uses this technique to update users’ feeds based on their tweets.
In general, for each user request that can be made without reloading the entire page content, show only the answer; It is possible to use Ajax.