The first application is a small application for testing the customer login functionality of the api. A string is sent to the API and a
result set is returned which is parsed using DOM and an alert is shown which contains the firstname and lastname attributes of the customer element that was returned.
Showcustomer
The function called showCustomer is executed by the onload event of the body tag. The onload event is useful for things such as greeting screens for customers or adverts as no input is required from the user.
If combined with cookies it can be used for a greeting screen such as the greeting from amazon i.e. "Welcome back mr Galafinakis" that does not require user input
every time the user returns to the site. The getCustomer function is part of the AJAX api and it returns the customer data for a certain userID in this case a predefined string containing the customer ID "Haakon".
ResultCustomer
The other function ResultCustomer is called automatically by jQuery when the data has been returned.
getCustomer
The getcustomer function returns the customer data for a certain customer ID.
If the customer ID does not exist, no customer element is returned.