JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<input type="button" name="Hide" id="Hide" value="Hide me" />
JavaScript
var api = {
user: null,
authString: null,
nextTrac: null,
tracactions: null,
actiondates: null,
tempTrac: null,
tracPerms: {
neg: false,
pos: false
},
forComply: [],
tempAction: null,
tempActionDate: null,
schools: [],
students: [],
student: null,
tracCodes: [],
schoolActions: [],
connection: {
baseUrl: '',
apiUrl: '/PT6/Mobile/'
},
events : [],
eventCategories : [],
initialize: function() {
api.setupAjaxDefaults();
// api.connection.baseUrl = 'http://plascotractest.plascoid.com';
api.connection.baseUrl = 'http://mobile.heropowered.com';
// api.connection.baseUrl = 'http://52.1.83.142';
},
AuthenticateUser: function(userCode, password) {
var md5Password = '8AC544033822A7B7CDDED71219B6871E';
var token = userCode + '|' + md5Password;
$.ajax({
url: 'http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20json%20where%20url%3D%22' + encodeURIComponent(api.connection.baseUrl + api.connection.apiUrl + 'AuthenticateUserInClear') + '%22&format=json&callback=?',
data: JSON.stringify({ userCodePswPipeDelimited: token }),
type: 'POST',
success: function(result, status, xhr) {
if (result && result.UserID > 0) {
api.user = result;
app.store.set('user', JSON.stringify(api.user));
app.store.set('authString', api.user.CustomSecurityToken);
app.db.cacheAuth(result);
api.setupAjaxDefaults(api.user.CustomSecurityToken);
api.setTracPerms(api.user.PosNegTracCodePermission);
api.authComplete();
}
else {
api.authError('Username or Password is incorrect');
app.slider.slidePageFrom(new views.login(app.tpl.login).render().el, 'left');
}
},
error: function(jqXHR, textStatus, errorThrown) {
alert('Server not found: '+ textStatus, function() {
app.slider.slidePageFrom(new views.login(app.tpl.login).render().el, 'left');
...