-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
82 lines (64 loc) · 1.94 KB
/
script.js
File metadata and controls
82 lines (64 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
var response,username,password;
var status;
var xhttp;
xhttp = new XMLHttpRequest();
var loginuser = function(){
return new Promise(function(resolve,reject){
if(1 == 1)
resolve();
})
}
loginuser().then(function(){
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200 )
{
console.log("c");
status = this.status;
response = this.responseText;
console.log(response);
response =JSON.parse(response);
}
}
})
.catch(console.log("ss"));
xhttp.open('GET','https://exptest.herokuapp.com/api/imageGallery', true);
xhttp.send();
// function ValidateEmail(mail)
// { //to validate email
// if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(mail))
// {
// return true ;
// }
// alert("You have entered an invalid email address!");
// return false ;
// }
// function validate(){
// username = document.getElementById("email").value;
// password = document.getElementById("pword").value;
// sendrequest(username,password);
// function sendrequest(uname,pword){
// //to send request to server
// xhttp = new XMLHttpRequest();
// xhttp.open("POST", "https://exptest.herokuapp.com/api/login", true);
// xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
// var data ="userName="+ username+"&password="+ password;
// xhttp.send(data);
// xhttp.onreadystatechange = function() {
// if (this.readyState == 4 ){
// console.log("c");
// status = this.status;
// response = this.responseText;
// console.log(response);
// response =JSON.parse(response);
// status =response.status;
// if ( status == 200){
// alert ("Login successfully");
// window.location = "dashboard.html"; // Redirecting to other page.
// return false;
// }
// else{
// alert (response.status);
// }
// }
// };
// }