forked from cmpe281/cmpe281.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
69 lines (65 loc) · 2.39 KB
/
Copy pathscript.js
File metadata and controls
69 lines (65 loc) · 2.39 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
$(function(){
var includes = $('[data-include]');
jQuery.each(includes, function(){
var file = $(this).data('include') + '.html';
$(this).load(file);
});
$("#createAdmin").click(function(){
var usrname = document.getElementById('usrname').value;
var fname = document.getElementById('fname').value;
var lname = document.getElementById('lname').value;
var address = document.getElementById('address').value;
var email = document.getElementById('email').value;
var contactNo = document.getElementById('contactNo').value;
var password = document.getElementById('password').value;
$.ajax({
type: 'POST',
url: 'http://localhost:8080/user',
data: JSON.stringify ({firstName:fname,lastName:lname,username:usrname,password:password,address:address,email:email,contactNumber:contactNo,role:{id:'2',name:'admin'} }),
success: function(data) { alert('data: ' + data); },
contentType: "application/json",
dataType: 'json'
});
});
$("#goBack").click(function(){
window.history.back();
});
$("#login").click(function(){
window.location.href = "admin-dashboard.html";
var username = document.getElementById('username').value;
var password = document.getElementById('password').value;
return false;
/*<!-- $.ajax({
type: 'GET',
url: 'http://localhost:8080/user',
contentType: "application/json",
dataType: 'json' ,
data: JSON.stringify ({username:usrname,password:password }),
success: function(data) {
window.location.href = "admin-dashboard.html";
}
}); -->*/
});
$("#createUserNode").click(function(){
var userNode = document.getElementById('userNode').value;
$.ajax({
type: 'POST',
url: 'http://localhost:8080/usernode',
data: JSON.stringify ({name:userNode}),
success: function(data) { alert('data: ' + data); },
contentType: "application/json",
dataType: 'json'
});
});
$("#createServiceNode").click(function(){
var serviceNode = document.getElementById('serviceNode').value;
$.ajax({
type: 'POST',
url: 'http://localhost:8080/servicenode',
data: JSON.stringify ({name:serviceNode}),
success: function(data) { alert('data: ' + data); },
contentType: "application/json",
dataType: 'json'
});
});
});