This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).on("pageinit", "#mainPage" ,function(event) { | |
checkConnection(); | |
console.log("pageinit"); | |
$("#submitButton").on("touchend",function(e) { | |
console.log("touchend for button"); | |
e.preventDefault(); | |
var btn = $(this); | |
//disable the button so we can't resubmit while we wait | |
btn.attr("disabled","disabled"); | |
var u = $("#username").val(); | |
var p = $("#password").val(); | |
if(u === '' || p === '') return; | |
$.get(serviceURL + "?method=login", {login:u, password:p, returntype:'json'}, function(res) { | |
//require res.user and it being an array | |
if(!res.user || !res.user[0]) return; | |
btn.removeAttr("disabled"); | |
if(res.user[0].status == "InvalidData") { | |
navigator.notification.alert("Your login failed.", function() {}); | |
} else { | |
user = res.user[0]; | |
$.mobile.changePage("scan.html"); | |
} | |
},"json"); | |
return false; | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment