/lenasys/0.1

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/lenasys/0.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<span class="description">
<br>
<div class="descriptionheading">Overview</div>

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>

<div class="descriptionheading">storeCustomer</div>
The function called <span class="interestingdescription">storeCustomer</span> 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 <span class="interestingdescription">customerID</span>) is retrieved to a set of variables that are then sent to the api.
<br><br>

<div class="descriptionheading">ResultCustomer</div>

The other function <span class="interestingdescription">ResultCustomer</span> is called automatically by jQuery when the data has been returned. 

<br><br><div class="descriptionheading">booking/makecustomer_XML.php</div>

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>

<br><div class='exampleheading'>Api Call Example:<br><br>
<pre class="codeexample">
$.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
});</pre>
</div>

<br>

<br><div class='exampleheading'>Returned Data Example:<br><br>
<span class="codeexample">&lt;created status="Error: Duplicate entry 'Haakon' for key 1"/&gt;</span>
</div>
																	
</span>