Added a close button to the alert messages.
Expect a json object from the server with the url to redirect to if the exchange code is successful. Show an alert message if an error occurs.
Improve verification of the parameter email to avoid null pointer exception and consequent internal server error.
Content negotiation: if accept-type includes json, send an ok response with a json object including the url to redirect to.