|
@ -72,25 +72,19 @@ async function search(e){ |
|
|
if(!results) return; |
|
|
if(!results) return; |
|
|
|
|
|
|
|
|
var listItems = results.map(myfunction); |
|
|
var listItems = results.map(myfunction); |
|
|
window.localStorage.setItem('movieID', (results.movieID)); |
|
|
|
|
|
var movieID=window.localStorage.getItem('movieID'); |
|
|
|
|
|
|
|
|
|
|
|
function myfunction(results){ |
|
|
function myfunction(result){ |
|
|
var x = document.createElement("li"); |
|
|
var x = document.createElement("li"); |
|
|
var a = document.createElement("a"); |
|
|
var a = document.createElement("a"); |
|
|
var t = document.createTextNode(results.title); |
|
|
var t = document.createTextNode(result.title); |
|
|
x.appendChild(a); |
|
|
x.appendChild(a); |
|
|
a.appendChild(t); |
|
|
a.appendChild(t); |
|
|
a.setAttribute("href","https://mkr.thefeathers.in/movie/"+movieID); |
|
|
a.setAttribute("href","/moviesPage?movieId=" + result.movieId); |
|
|
x.setAttribute("class","list"); |
|
|
x.setAttribute("class","list"); |
|
|
return x; |
|
|
return x; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
document.getElementById("slideContainer").append(...listItems); |
|
|
document.getElementById("slideContainer").append(...listItems); |
|
|
|
|
|
|
|
|
$('.list').click(function(event){ |
|
|
|
|
|
moviePage(event); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
} |
|
|
catch (err) { |
|
|
catch (err) { |
|
|
//Failure
|
|
|
//Failure
|
|
@ -98,35 +92,6 @@ async function search(e){ |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async function moviePage(e){ |
|
|
|
|
|
e.preventDefault(); |
|
|
|
|
|
var Token=window.localStorage.getItem('Token'); |
|
|
|
|
|
var movieID=window.localStorage.getItem('movieID'); |
|
|
|
|
|
window.location = "searchmovies.html"; |
|
|
|
|
|
try { |
|
|
|
|
|
const response = await fetch('https://mkr.thefeathers.in/movie/'+movieID, { |
|
|
|
|
|
method: 'GET', |
|
|
|
|
|
headers: new Headers({'content-type': 'application/json', 'Authentication': Token }), |
|
|
|
|
|
}); |
|
|
|
|
|
const data3 = await response.json(); |
|
|
|
|
|
//Success code goes here
|
|
|
|
|
|
alert(JSON.stringify(data3)); |
|
|
|
|
|
var results1 =data2.results; |
|
|
|
|
|
|
|
|
|
|
|
window.location = "moviesPage.html"; |
|
|
|
|
|
document.getElementById("Container").append(results1.movieID); |
|
|
|
|
|
document.getElementById("Container").append(results1.title); |
|
|
|
|
|
document.getElementById("Container").append(results1.overview); |
|
|
|
|
|
document.getElementById("Container").append(results1.poster); |
|
|
|
|
|
document.getElementById("Container").append(results1.release); |
|
|
|
|
|
document.getElementById("Container").append(results1.watchStatus); |
|
|
|
|
|
document.getElementById("Container").append(results1.rating); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
catch (err) { |
|
|
|
|
|
//Failure
|
|
|
|
|
|
alert('Error'); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|