-
Notifications
You must be signed in to change notification settings - Fork 0
/
roller.html
executable file
·46 lines (35 loc) · 979 Bytes
/
roller.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
<!DOCTYPE html>
<html>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js" type="text/javascript"></script>
<script>
function success(data) {
document.getElementById("diceRoll").innerHTML = "Rolls: " + data['rolls'] + " = " + data['total'];
}
function getMethod(apiCall) {
$.ajax({
type: 'GET',
url: apiCall,
async: false,
dataType: 'json',
success: success
});
}
function myFunction() {
var text;
var fullURL = "http://api.d20futurepath.com/v1/tasks/roll/"
var apiCall
// Get the value of the input field with id="diceStr"
text = document.getElementById("dice").value;
apiCall = fullURL + text;
// document.getElementById("diceRoll").innerHTML = apiCall;
getMethod(apiCall)
}
</script>
<body>
<h1>Future Path Dice Rolling Tool</h1>
<p>Please input the dice IE: d20+d4:</p>
<input id="dice">
<button type="button" onclick="myFunction()">Submit</button>
<p id="diceRoll"></p>
</body>
</html>