-
Notifications
You must be signed in to change notification settings - Fork 0
/
storage.js
74 lines (57 loc) · 2.89 KB
/
storage.js
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
70
71
72
73
/**
* Created by Sai on 9/5/2015.
*/
$(document).ready(function(){
$("#search").click(function(){
event.preventDefault();
var director=document.getElementById("director").value;
console.log(director);
$.ajax({
url:"http://netflixroulette.net/api/api.php?director=Quentin",
error:function(){
$("#error").text("please check the link")
},
success:function(data){
console.log(data);
for(var i=0;i<data.length;i++){
if(data[i].director==director)
{
var title=document.createTextNode(data[i].show_title);
var year=document.createTextNode("("+data[i].release_year+")");
var summarymovie=document.createTextNode(data[i].summary);
var rating=document.createTextNode(data[i].rating);
var directorofmovie=document.createTextNode(data[i].director);
var nodefortitle=document.createElement("div");
nodefortitle.setAttribute("id","title");
nodefortitle.appendChild(title);
var nodeforyear=document.createElement("div");
nodeforyear.setAttribute("id","year");
nodeforyear.appendChild(year);
var nodeforsummary=document.createElement("div");
nodeforsummary.setAttribute("id","summary");
nodeforsummary.appendChild(summarymovie);
var nodeforrating=document.createElement("div");
nodeforrating.setAttribute("id","rating");
nodeforrating.appendChild(rating);
var nodefordirector=document.createElement("div");
nodefordirector.setAttribute("id","director1");
nodefordirector.appendChild(directorofmovie);
var nodeforimage=document.createElement("img");
nodeforimage.setAttribute("id","poster");
nodeforimage.setAttribute("src",data[i].poster);
var parentnode=document.createElement("div");
parentnode.setAttribute("id","content");
parentnode.appendChild(nodefortitle);
parentnode.appendChild(nodeforyear);
parentnode.appendChild(nodeforsummary);
parentnode.appendChild(nodeforrating);
parentnode.appendChild(nodefordirector);
parentnode.appendChild(nodeforimage);
document.getElementById("error").appendChild(parentnode);
}
}
},
type:"GET"
})
})
})