# Ajax and the XMLHttpRequest class
## Obiettivi di apprendimento

* be aware of JavaScript APIs
* know some of the standard JavaScript libraries
* be able to understand the concept of Ajax requests.

## Trascrizione

index.html
Register.java

## Quiz

<quiz display='simple'> {What is true about using JavaScript for issuing an HTTP request from some webpage?} + Usually only HTTP requests to the domain from which the webpage that contains the calling JavaScript was downloaded are possible - It is possible to make HTTP requests to other servers if they run on port 433 + It is possible to make HTTP requests to other servers if they have a cross origin resource sharing policy + It is possible if the from which the webpage that contains the calling JavaScript was downloaded is white listed in the Access-Origin Header field of the server response. - If not allowed the browser will prevent JavaScript from making the HTTP request. |interestingly the request is made and only the response is dropped (this makes sense otherwise the Access-Control header of the response could not be processed by the browser SEND MAIL TO CHRISTOPH) - the repsonse has to be in JSON (JavaScript object notation) | No, the response can be in any format.
{Why is JavaScript usefull for the World Wide Web?} + It enables more interactive websites | even though HTML allows for input fields and text areas JavaScript increases the amount of interactivity + It can take loads of traffic from the web server or the web server's backend | yes for example if data needs to be sorted this can easily be done by the client - It can help websites to better communicate with search engines and provide metadata like RDFa | No indeed search engines frequently ignore JavaScript - Without JavaScript, the structure of web content could not be completely seperated from layout and formatting | JavaScript does not aim to support people to separate structure from layout and formatting + It can help to easily make asynchronous HTTP requests to a web server | This is useful since a webpage does not have to be assembled at the server which blocks but can rather be asynchronously assembled on the client side.
{What are the advantages of JavaScript libraries?} + They provide an API that will work on almost any browser | The most popular browsers and many different versions are supported by these libraries. - They make JavaScript more powerful | No, they don't change the expressiveness of JavaScript at all
{Which of the following are JavaScript libraries} + jQuery - PHP - Java + mootools + Prototype - Netscape

## Ulteriori letture

* https://en.wikipedia.org/wiki/XMLHttpRequest
* https://en.wikipedia.org/wiki/Cross-origin_resource_sharing

## Discussioni

* Ethernet
** Communication over a shared Medium
** Ethernet header
** Minimum package length vs maximum cable length
** Collision detection
** Summary, further reading, homework
* Internet Protocol
** Motivation for IP
** Classful IPv4 networks
** IP forwarding algorithm
** IP header
** Summary, further reading, homework
* Transmission Control Protocol
** End to end principle and connection oriented communication
** Three way handshake
** Port numbers
** Sliding window and flow control
** Summary, further reading, homework
* Domain Name System
** Tree structure
** Terminology
** Zones
** Review some facts about DNS
** Delegating DNS queries
** DNS address resolution
** Summary, further reading, homework
* Internet vs World Wide Web
** Summary of the internet architecture
** Motivation and requirements for the World Wide Web
** Design principles of the web
** Uniform Resource Identifier
** Summary, further reading, homework
* Hypertext Transfer Protocol
** Making HTTP requests
** A simple web client
** A simple web server
** HTTP header
** Content negotiation
** Summary, further reading, homework
* Web content
** Problem setting for web content formats
** Working with XML
** HTML for web document structures
** Layout elements in HTML
** Motivating separation of content and layout
** Cascading Style Sheets
** Media content
** Metadata
** Summary, further reading, homework
* Dynamic Web Content
** Basics of server side web programming
** Forms and HTTP post request
** Handling a post request in a Java Servlet
** Client side JavaScript
** Ajax and the XMLHttpRequest class
** Summary, further reading, homework