AJAX allows you to grab content from your server, within your webpage, for example when a user clicks on something, and do something with that, WITHOUT refreshing/reloading the page. It makes your websites fun, interactive, and fast.
One downside is that you can't use AJAX on your local files. It has to be worked on live servers.
Get allows you to get data from the server, like AJAX, and do something with it without refreshing/reloading the page, however, it doesn't interact with the user if the get fails. In other words, if the get is successful, you can do something, however if it fails then nothing happens, nor is the user notified.
In comparison, AJAX allows you to handle different situations. For e.g. '.done' allows you to create/call a function that is executed when the AJAX call is successful. You can use '.fail' to create/call a function that is executed when the AJAX call fails.
In this excercise we will read a file from the server, using get, and display the output underneath. Note: If the name of the file specified was invalid, or the actual file did not exist, then nothing would happen. This is the shortcoming of GET.
In this excercise we will read a file from the server, using AJAX, and display the output underneath. Note: Unlike GET, AJAX can handle both success (.done) and failure (.fail).
Filename: