|
@ -1,12 +1,8 @@ |
|
|
var searchkey; |
|
|
|
|
|
$(document).ready(function(){ |
|
|
$(document).ready(function(){ |
|
|
$('.message a').click(function(){ |
|
|
$('.message a').click(function(){ |
|
|
$('form').animate({height: "toggle", opacity: "toggle"},"slow"); |
|
|
$('form').animate({height: "toggle", opacity: "toggle"},"slow"); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
$('.search-btn').click(function() { |
|
|
|
|
|
searchkey= $('.search-movies').val(); |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
async function submitForm(e){ |
|
|
async function submitForm(e){ |
|
@ -61,6 +57,7 @@ async function submitForm1(e){ |
|
|
|
|
|
|
|
|
async function search(e){ |
|
|
async function search(e){ |
|
|
e.preventDefault(); |
|
|
e.preventDefault(); |
|
|
|
|
|
var searchkey= $('.search-movies').val(); |
|
|
var Token=window.localStorage.getItem('Token'); |
|
|
var Token=window.localStorage.getItem('Token'); |
|
|
try { |
|
|
try { |
|
|
const response = await fetch('https://mkr.thefeathers.in/search/'+searchkey, { |
|
|
const response = await fetch('https://mkr.thefeathers.in/search/'+searchkey, { |
|
@ -71,16 +68,29 @@ async function search(e){ |
|
|
//Success code goes here
|
|
|
//Success code goes here
|
|
|
//window.location = "searchmovies.html";
|
|
|
//window.location = "searchmovies.html";
|
|
|
alert(JSON.stringify(data2)); |
|
|
alert(JSON.stringify(data2)); |
|
|
var str = '<ul>' |
|
|
var results =data2.results; |
|
|
var result = data2.results; |
|
|
if(!results) return; |
|
|
result.forEach(myfunction); |
|
|
|
|
|
|
|
|
var listItems = results.map(myfunction); |
|
|
|
|
|
window.localStorage.setItem('movieID', (results.movieID)); |
|
|
|
|
|
var movieID=window.localStorage.getItem('movieID'); |
|
|
|
|
|
|
|
|
|
|
|
function myfunction(results){ |
|
|
|
|
|
var x = document.createElement("li"); |
|
|
|
|
|
var a = document.createElement("a"); |
|
|
|
|
|
var t = document.createTextNode(results.title); |
|
|
|
|
|
x.appendChild(a); |
|
|
|
|
|
a.appendChild(t); |
|
|
|
|
|
a.setAttribute("href","https://mkr.thefeathers.in/movie/"+movieID); |
|
|
|
|
|
x.setAttribute("class","list"); |
|
|
|
|
|
return x; |
|
|
|
|
|
|
|
|
function myfunction(slide){ |
|
|
|
|
|
str += '<li>'+ slide + '</li>'; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
document.getElementById("slideContainer").append(...listItems); |
|
|
|
|
|
|
|
|
str += '</ul>'; |
|
|
$('.list').click(function(event){ |
|
|
document.getElementById("slideContainer").innerHTML = str; |
|
|
moviePage(event); |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
catch (err) { |
|
|
catch (err) { |
|
|
//Failure
|
|
|
//Failure
|
|
@ -88,5 +98,35 @@ 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'); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|