Added a search bar and button

This commit is contained in:
Kevin Midboe
2017-02-08 19:28:52 +01:00
parent e74bbd0abf
commit 8c6e142dc4

View File

@@ -4,14 +4,21 @@
<title>tmdb.org Search Displayer</title> <title>tmdb.org Search Displayer</title>
</head> </head>
<body> <body>
<input type='text' id='link_id'>
<input type='button' id='btnSearch' value='Search' onClick="search(this)"'>
<p id="display"></p> <p id="display"></p>
</body> </body>
<script type="text/javascript"> <script type="text/javascript">
function request(id){ var button = document.getElementById("btnSearch");
console.log(id);
button.onclick = function () {
var text = document.getElementById("link_id").value;
console.log(text);
queryTMDB(text);
} }
function queryTMDB(query) {
var data = "{}"; var data = "{}";
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
@@ -49,9 +56,11 @@
} }
}); });
xhr.open("GET", "http://localhost:63590/api/v1/plex/request?query=star+wars"); xhr.open("GET", "http://localhost:63590/api/v1/plex/request?query="+query);
console.log(data);
xhr.send(data); xhr.send(data);
}
</script> </script>
</html> </html>