Overview
The storage application collects the id,name,address and email from a form and sends it to the api which promptyl creates a new customer.

storeCustomer
The function called storeCustomer is executed by the onclick event of the form at the bottom of the code. The click event is useful for things such as processing form data after a mouse click on a button/image/div/span etc. The $.ajax function is part of the jQuery api and sends a POST request to booking/makecustomer_XML.php which adds a customer to the database. The data from the form (for example customerID) is retrieved to a set of variables that are then sent to the api.

ResultCustomer
The other function ResultCustomer is called automatically by jQuery when the data has been returned.

booking/makecustomer_XML.php
MakeCustomer makes an insert to the database. The function makes no checks on the data, and if any error occurs, the error message is returned as a status message.

Api Call Example:

$.ajax({
	type: 'POST',
	url: 'booking/makecustomer_XML.php',
	data: { ID: escape(customerID),
		firstname: escape(firstname),
		lastname: escape(lastname),
		email: escape(email),
		address: escape(address),
	},
	success:  ResultCustomer
});


Returned Data Example:

<created status="Error: Duplicate entry 'Haakon' for key 1"/>