Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!doctype html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>Exam</title>
- <link rel="stylesheet" href="jquery/jquery-ui.css">
- <script src="jquery/jquery.js"></script>
- <script src="jquery/jquery-ui.js"></script>
- <style type="text/css">
- .container{
- width: 400px;
- height: 800px;
- display: inline-block;
- }
- #right{
- float: right;
- }
- #main{
- width: 800px;
- }
- </style>
- <script type="text/javascript">
- var autoComplete = [ "Kingsman", "Tomorrowland", "Jurassic World", "San Andreas Quake", "Survivor",
- "Ex Machina", "Focus", "Blackhat", "Chappie", "Fury", "Big Hero 6", "Predestination",
- "Gone Girl", "Jupiter Ascending", "John Wick", "Seventh Son", "Lucy", "American Sniper" , "Grown ups"
- ];
- $(document).ready(function () {
- $("#searchTerm").autocomplete({
- source: autoComplete
- });
- var title;
- $("#search").click(function () {
- title = $("#searchTerm").val();
- $.ajax({
- url:"http://omdbapi.com/?t=" + title,
- dataType: "jsonp",
- success: function (result) {
- console.log(result.Genre);
- var flag = 0;
- var lista = result.Genre.split(" ");
- for(var i=0; i<lista.length; i++) {
- console.log(lista[i]);
- if (lista[i] == "Comedy" || lista[i] == "Comedy,") {
- flag = 1;
- }
- }
- if (flag == 1) {
- $(".container > ul").append("<li style='color: red'><span>" + result.Title + "</span></li>");
- }
- else {
- $(".container > ul").append("<li><span id='tekst'>" + result.Title + "</span></li>");
- }
- }
- });
- });
- $(".container ul li").click(function() {
- console.log("okej");
- });
- });
- </script>
- </head>
- <body>
- <div id="main">
- <div >
- <span id="get">
- <h1> IA EXAM </h1>
- <input type="text" id="searchTerm" />
- <button id="search">Get</button>
- </span>
- </div>
- <div class="container">
- <strong>Current movies</strong>
- <br>
- <ul>
- </ul>
- </div>
- <div id="right" class="container">
- <strong>Drop a movie here to delete it</strong>
- <br>
- </div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement