1
<span class="description">
3
<div class="descriptionheading">Overview</div>
5
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.<br><br>
7
<div class="descriptionheading">storeCustomer</div>
8
The function called <span class="interestingdescription">storeCustomer</span> is executed by the onclick event of the form at the bottom of the code.
9
The click event is useful for things such as processing form data after a mouse click on a button/image/div/span etc.
10
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.
11
The data from the form (for example <span class="interestingdescription">customerID</span>) is retrieved to a set of variables that are then sent to the api.
14
<div class="descriptionheading">ResultCustomer</div>
16
The other function <span class="interestingdescription">ResultCustomer</span> is called automatically by jQuery when the data has been returned.
18
<br><br><div class="descriptionheading">booking/makecustomer_XML.php</div>
20
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.<br>
22
<br><div class='exampleheading'>Api Call Example:<br><br>
23
<pre class="codeexample">
26
url: 'booking/makecustomer_XML.php',
27
data: { ID: escape(customerID),
28
firstname: escape(firstname),
29
lastname: escape(lastname),
31
address: escape(address),
33
success: ResultCustomer
39
<br><div class='exampleheading'>Returned Data Example:<br><br>
40
<span class="codeexample"><created status="Error: Duplicate entry 'Haakon' for key 1"/></span>