1234567891011121314151617181920212223242526272829303132333435363738 |
- <h1>
- {{title}}
- </h1>
- <form id="login">
- <div>
- Username: <input name="username" type="text"/>
- </div>
- <div>
- Password: <input name="password" type="password"/>
- </div>
- <input type="submit" value="login"/>
- <input type="button" value="cancel" class="cancel"/>
- </form>
- <script>
- $('form#login').submit(function(){
- var data = $(this).serializeObject(),
- State = History.getState();
- for(var i in State.data){
- data[i] = State.data;
- }
- data.type = 'action';
- data.id = 'login';
- apiCall(data,function(d){
- if(!d.error){
- setKey(d.key);
- History.go(-1);
- }else{
- setKey(null);
- apiState('page-login');
- }
- return false;
- });
- return false;
- }).children('.cancel').click(function(){
- loadState('page-index');
- return false;
- });
- </script>
|