-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetotp.html
60 lines (57 loc) · 2 KB
/
getotp.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>GetOTP</title>
<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<link href="css/component.css" rel="stylesheet" type="text/css"/>
<link href="css/login.css" rel="stylesheet" type="text/css"/>
<script src="js/jquery-1.11.2.min.js" type="text/javascript"></script>
</head>
<body class="login">
<div class="content">
<h3 class="form-title">Get OTP SMS</h3>
<div class="form-group">
<label class="control-label">Telephone Number</label>
<div>
<input class="form-control" type="text" placeholder="Your Mobile Phone Number" name="telephone" id="telephone"/>
</div>
</div>
<div class="form-actions">
<button class="btn blue" id="getotp" type="submit">Get SMS</button>
</div>
</div>
</body>
<script type="text/javascript">
jQuery(document).ready(function(){
$("#getotp").on("click",function(){
var telephone = $("#telephone").val();
if (telephone == null || telephone == ""){
alert("Telephone cannot be blank.");
return false;
}
$.ajax({
type:"POST",
contentType:"application/x-www-form-urlencoded",
url:"http://localhost:8098/user/getotp",
data:{
"telephone":telephone,
},
xhrFields:{withCredentials:true},
success:function(data){
if(data.status == "success"){
alert("OTP has sent to your mobile phone.");
window.location.href = "register.html";
}else{
alert("OTP sending failed, caused by "+ data.data.errMsg);
}
},
error:function(data){
alert("Sending Exception, caused by:"+data.responseText);
}
});
return false;
});
});
</script>
</html>