Last change
on this file since 91 was 91, checked in by wouter, 5 years ago |
and use first of result if 'me' queried
|
File size:
1010 bytes
|
Line | |
---|
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
---|
2 | <html>
|
---|
3 | <head>
|
---|
4 | <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
|
---|
5 | <meta content="utf-8" http-equiv="encoding">
|
---|
6 | <title>Welcome user</title>
|
---|
7 |
|
---|
8 | </head>
|
---|
9 | <body onload="init()">
|
---|
10 | <h1>Welcome User <div id="name">-</div></h1>
|
---|
11 |
|
---|
12 | You logged in and have ID :
|
---|
13 |
|
---|
14 | <div id="id">-</div>
|
---|
15 |
|
---|
16 |
|
---|
17 | <script>
|
---|
18 | "use strict";
|
---|
19 |
|
---|
20 |
|
---|
21 | function init() {
|
---|
22 | var xmlHttp = new XMLHttpRequest();
|
---|
23 | xmlHttp.open("GET", "Accounts?me", true);
|
---|
24 | xmlHttp.onreadystatechange = function() {
|
---|
25 | if (xmlHttp.readyState == 4) {
|
---|
26 | if (xmlHttp.status == 200) {
|
---|
27 | var res=JSON.parse( xmlHttp.responseText )[0];
|
---|
28 | document.getElementById('name').innerHTML = res['name'];
|
---|
29 | document.getElementById('id').innerHTML = res['id'];
|
---|
30 | } else {
|
---|
31 | alert("access denied!");
|
---|
32 | }
|
---|
33 | }
|
---|
34 | }
|
---|
35 | xmlHttp.send();
|
---|
36 |
|
---|
37 | }
|
---|
38 | </script>
|
---|
39 |
|
---|
40 | <noscript>Sorry, your browser does not support JavaScript!</noscript>
|
---|
41 | </body>
|
---|
42 | </html>
|
---|
Note:
See
TracBrowser
for help on using the repository browser.