forked from IshaniAmin/Maestro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Ticketmaster-API-Test.html
69 lines (42 loc) · 1.47 KB
/
Ticketmaster-API-Test.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
61
62
63
64
65
66
67
68
69
<!DOCTYPE html>
<html>
<head>
<title>Testing Ticketmaster API</title>
<link rel="stylesheet" type="text/css" href="assets/css/reset.css">
<link rel="stylesheet" type="text/css" href="assets/css/style.css">
</head>
<body>
<h2> Type in an Artist you would like to see! </h2>
<form id="artist-search">
<input for=search type="text" id="query" value="" class="form-control" />
<input type="submit" id="search" class="button" value="Search" />
</form>
<br><br>
</form>
<script src="https://code.jquery.com/jquery.js"></script>
<script type="text/javascript">
$(document).ready( function() {
function results() {
var artistInput = $("#query").val().trim();
var queryURL = "http://app.ticketmaster.com/discovery/v1/events.json?keyword="+ artistInput +"&apikey=zyleKSfADiALla0NEoeit7ieP42ITTfA&callback=myFunction"
$.ajax({
url: queryURL,
method: "GET"
}).done(function(response) {
var div = $("<div>");
for (var i = 0; i < response._embedded.events.length; i++) {
var events = response._embedded.events[i].name;
var city = response._embedded.events[i]._embedded.venue[0].city.name;
var state = response._embedded.events[i]._embedded.venue[0].state.stateCode;
div.append(i+1 + ". " + events + " in " + city + ", " + state + "<br>");
}
$("body").html("<h1>Upcoming performances</h1>");
$("body").append(div);
});
return false;
};
$(document).on("click", "#search", results);
});
</script>
</body>
</html>