diff options
-rw-r--r-- | index.html | 34 |
1 files changed, 23 insertions, 11 deletions
@@ -2,25 +2,37 @@ <html> <head> <title>Radio Helsinki - Automation Import</title> + <meta charset="utf-8"> <link rel="stylesheet" type="text/css" href="/styles/import.css" /> <script src="/javascript/jquery/jquery.min.js"></script> <script type="text/javascript"> - function authenticate() + function authSuccess(data) { + alert("username: " + data.username + "\ntoken: " + data.token ); + } + + function auth() { - alert("hello world"); + $.get("/authtoken.json", authSuccess, "json"); } + + $("#loginform").submit(function(event) { + auth() + event.preventDefault(); + }); </script> </head> <body> <h1>Radio Helsinki - Automation Import</h1> - <p> - <form onSubmit="authenticate()"> - <ul> - <li><label for="name">Benutzername:</label> <input type="text" id="username" value=""> </li> - <li> <label for="pass">Kennwort:</label> <input type="password" id="password" value=""> </li> - <li> <input type="submit" value="Einloggen"> </li> - </ul> - </form> - </p> + <form id="loginform"> + <ul> + <li> <label for="name">Benutzername:</label> <input type="text" id="username" value=""> </li> + <li> <label for="pass">Kennwort:</label> <input type="password" id="password" value=""> </li> + <li> <input type="submit" value="Einloggen"> </li> + </ul> + </form> + + <script type="text/javascript"> + $("#loginform").submit(function(event) { auth(); event.preventDefault(); }); + </script> </body> </html> |