jQuery + AJAX + PHP
PHP (PHP: Hypertext Preprocessor): a generic programming language designed and frequently used for sever-side web development.
While external hosting can certainly be used for going through these materials, it is highly recommended to either setup a local, testing PHP web server or using something like the php-server package in Atom for creating a developmental server.
jQuery provides a $.ajax() function that serves as a shorthand for browser functionality to send asynchronous requests to a server. Depending on the options used, different responses can be received, parsed, or used in various ways. However, by default, all responses are assumed to be text.
Once loaded, the $.ajax() function can be called. (The options used will be covered in more depth in the next part.)
On the server side, a file named “response.php” (matching the file requested in the Ajax call) is created. For this example, it merely echos back one of the values passed to it from the same call.
Getting a Response
Assuming everything worked correctly, the function .done() as part of the $.ajax() call will receive the message sent by the server. (Echoing the values passed to it.)
Finally, it will change the text content of the element with the ID “log”.