Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function loginClicked()
- {
- var password = document.getElementById('password').value;
- var user = document.getElementById('user').value;
- var dataString="username="+user+"&password="+password;
- xhr = new XMLHttpRequest();
- xhr.open('POST', 'http://192.168.0.2/login/include/procLogin.php');
- xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
- xhr.onload = function() {
- if(xhr.responseText === "0") {
- navigator.notification.alert(
- 'There is a problem with your credentials!', // message
- alertDismissed, // callback
- 'Login issue', // title
- 'Done' // buttonName
- );
- } else {
- //user logged in Therev
- var accessCode = xhr.responseText;
- document.getElementById('leftmenu').style.width = "250px";
- alert(accessCode);
- content.load('page/accounts.html')
- .then(document.getElementById('leftmenu').open());
- }
- if (xhr.status !== 200) {
- navigator.notification.alert(
- 'Please try again, communication error.', // message
- alertDismissed, // callback
- 'Login issue', // title
- 'Done' // buttonName
- );
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement