-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdelete.html
More file actions
73 lines (63 loc) · 2.59 KB
/
Copy pathdelete.html
File metadata and controls
73 lines (63 loc) · 2.59 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>PhoneModelAPI</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
</head>
<body>
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">PhoneModelAPI</a>
</div>
<ul class="nav navbar-nav">
<li class="active"><a href="/">Home</a></li>
<li><a href="/get">Get</a></li>
<li><a href="/post">Post</a></li>
<li><a href="/update">Update</a></li>
<li><a href="#">Delete</a></li>
</ul>
</div>
</nav>
<div class="container-fluid">
<iframe name="hiddenFrame" width="0" height="0" border="0" style="display: none;"></iframe>
<div class="col-sm-3" style="background-color:lavender;">
<label>Delete manufacturer:</label>
<input type="text" id="deleteCallMfr" name="deleteCallMfr" placeholder="e.g. manufacturers/samsung"><br>
<input type="button" id="deleteCallMfrBtn" value="DELETE" onclick="deleteManufacturer()"> <br><br>
<label>Delete phone:</label><br>
<input type="text" id="deleteCallPhone" name="deleteCallPhone" placeholder="e.g. manufacturers/apple/1">
<input type="button" id="deleteCallPhoneBtn" value="DELETE Phone" onclick="deletePhone()">
</div>
</div>
<script>
function deletePhone() {
let xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
console.log(xmlhttp.responseText)
}
};
xmlhttp.open("DELETE", "/api/v1/" + document.getElementById('deleteCallPhone').value ,true);
xmlhttp.send();
}
function deleteManufacturer() {
let xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
console.log(xmlhttp.responseText)
}
};
xmlhttp.open("DELETE", "/api/v1/" + document.getElementById('deleteCallMfr').value ,true);
xmlhttp.send();
}
</script>
</body>
</html>