Advertisement
sindi29

Untitled

Jan 28th, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Exam</title>
  6. <link rel="stylesheet" href="jquery/jquery-ui.css">
  7. <script src="jquery/jquery.js"></script>
  8. <script src="jquery/jquery-ui.js"></script>
  9. <style type="text/css">
  10.  
  11. .container{
  12. width: 400px;
  13. height: 800px;
  14. display: inline-block;
  15. }
  16. #right{
  17. float: right;
  18. }
  19.  
  20. #main{
  21. width: 800px;
  22. }
  23.  
  24.  
  25. </style>
  26.  
  27. <script type="text/javascript">
  28.  
  29. var autoComplete = [ "Kingsman", "Tomorrowland", "Jurassic World", "San Andreas Quake", "Survivor",
  30. "Ex Machina", "Focus", "Blackhat", "Chappie", "Fury", "Big Hero 6", "Predestination",
  31. "Gone Girl", "Jupiter Ascending", "John Wick", "Seventh Son", "Lucy", "American Sniper" , "Grown ups"
  32. ];
  33.  
  34. $(document).ready(function () {
  35. $("#searchTerm").autocomplete({
  36. source: autoComplete
  37. });
  38.  
  39. var title;
  40. $("#search").click(function () {
  41. title = $("#searchTerm").val();
  42. $.ajax({
  43. url:"http://omdbapi.com/?t=" + title,
  44. dataType: "jsonp",
  45.  
  46. success: function (result) {
  47. console.log(result.Genre);
  48. var flag = 0;
  49. var lista = result.Genre.split(" ");
  50. for(var i=0; i<lista.length; i++) {
  51. console.log(lista[i]);
  52.  
  53. if (lista[i] == "Comedy" || lista[i] == "Comedy,") {
  54. flag = 1;
  55. }
  56. }
  57. if (flag == 1) {
  58. $(".container > ul").append("<li style='color: red'><span>" + result.Title + "</span></li>");
  59. }
  60. else {
  61. $(".container > ul").append("<li><span id='tekst'>" + result.Title + "</span></li>");
  62. }
  63. }
  64. });
  65. });
  66.  
  67. $(".container ul li").click(function() {
  68.  
  69. console.log("okej");
  70.  
  71. });
  72.  
  73.  
  74. });
  75.  
  76.  
  77.  
  78. </script>
  79. </head>
  80. <body>
  81. <div id="main">
  82. <div >
  83. <span id="get">
  84. <h1> IA EXAM </h1>
  85. <input type="text" id="searchTerm" />
  86. <button id="search">Get</button>
  87. </span>
  88. </div>
  89. <div class="container">
  90. <strong>Current movies</strong>
  91. <br>
  92. <ul>
  93.  
  94. </ul>
  95. </div>
  96. <div id="right" class="container">
  97. <strong>Drop a movie here to delete it</strong>
  98. <br>
  99. </div>
  100. </div>
  101.  
  102. </body>
  103. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement