/lenasys/0.1

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/lenasys/0.1

« back to all changes in this revision

Viewing changes to trunk/Code Viewer Alt/AJAX/AjaxDemoApp1_storeCustomer.html

  • Committer: Henrik G.
  • Date: 2013-03-26 23:22:55 UTC
  • Revision ID: henrik.gustavsson@his.se-20130326232255-ik6snyatlbkf3zs1
First seed of Lenasys ... Needs to be Organized Further

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<html>
 
2
<head>
 
3
        <script language="javascript" src="../jquery/jquery-1.8.2.min.js"></script>
 
4
 
 
5
        <script language="javascript">
 
6
                // The API is passed the customer data and the name of the return function
 
7
                function storeCustomer()
 
8
                {
 
9
                        var customerID=document.getElementById("customerID").value;
 
10
                        var firstname=document.getElementById("firstname").value;
 
11
                        var lastname=document.getElementById("lastname").value;
 
12
                        var email=document.getElementById("email").value;
 
13
                        var address=document.getElementById("address").value;
 
14
 
 
15
                 $.ajax({
 
16
                                type: 'POST',
 
17
                                url: '../booking/makecustomer_XML.php',
 
18
                                data: { ID: escape(customerID),
 
19
                                        firstname: escape(firstname),
 
20
                                        lastname: escape(lastname),
 
21
                                        email: escape(email),
 
22
                                        address: escape(address),
 
23
                                },
 
24
                                success:  ResultCustomer
 
25
                        });
 
26
                }
 
27
        
 
28
                function ResultCustomer(returnedData)
 
29
                {
 
30
                        // Iterate over all nodes in root node (i.e. the 'created' element in root which has an attribute called status)
 
31
                        for (i = 0; i < returnedData.childNodes.length; i++) {
 
32
                                        if(returnedData.childNodes.item(i).nodeName=="created"){
 
33
                                                alert(returnedData.childNodes.item(i).attributes['status'].nodeValue);
 
34
                                        }
 
35
                        }
 
36
                }                               
 
37
 
 
38
        </script>
 
39
</head>
 
40
<body>
 
41
                        <form>
 
42
                                        ID: (is used to identify the user)<br><input type="text" id="customerID"> <br>
 
43
                                        firstname:<br><input type="text" id="firstname"><br>
 
44
                                        lastname:<br><input type="text" id="lastname"><br>
 
45
                                        address:<br><input type="text" id="address"><br>
 
46
                                        email:<br><input type="text" id="email"><br>
 
47
                                        <input type="button" value="Store Customer" onclick="storeCustomer();">
 
48
                                </form>
 
49
</body>
 
50
</html>