|
@ -34,7 +34,6 @@ async function submitForm(e){ |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
var token; |
|
|
|
|
|
|
|
|
|
|
|
async function submitForm1(e){ |
|
|
async function submitForm1(e){ |
|
|
e.preventDefault(); |
|
|
e.preventDefault(); |
|
@ -51,7 +50,7 @@ async function submitForm1(e){ |
|
|
const data1 = await response.json(); |
|
|
const data1 = await response.json(); |
|
|
//Success code goes here
|
|
|
//Success code goes here
|
|
|
alert(JSON.stringify(data1)); |
|
|
alert(JSON.stringify(data1)); |
|
|
token = data1.token; |
|
|
window.localStorage.setItem('Token', (data1.token)); |
|
|
window.location = "searchmovies.html"; |
|
|
window.location = "searchmovies.html"; |
|
|
} |
|
|
} |
|
|
catch (err) { |
|
|
catch (err) { |
|
@ -62,17 +61,26 @@ async function submitForm1(e){ |
|
|
|
|
|
|
|
|
async function search(e){ |
|
|
async function search(e){ |
|
|
e.preventDefault(); |
|
|
e.preventDefault(); |
|
|
|
|
|
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, { |
|
|
method: 'GET', |
|
|
method: 'GET', |
|
|
headers: new Headers({'content-type': 'application/json'}), |
|
|
headers: new Headers({'content-type': 'application/json', 'Authentication': Token }), |
|
|
headers: new Headers({ 'Authentication': token }) |
|
|
|
|
|
}); |
|
|
}); |
|
|
const data = await response.json(); |
|
|
const data2 = await response.json(); |
|
|
//Success code goes here
|
|
|
//Success code goes here
|
|
|
//window.location = "searchmovies.html";
|
|
|
//window.location = "searchmovies.html";
|
|
|
alert(JSON.stringify(data)); |
|
|
alert(JSON.stringify(data2)); |
|
|
|
|
|
var str = '<ul>' |
|
|
|
|
|
var result = data2.results; |
|
|
|
|
|
result.forEach(myfunction); |
|
|
|
|
|
|
|
|
|
|
|
function myfunction(slide){ |
|
|
|
|
|
str += '<li>'+ slide + '</li>'; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
str += '</ul>'; |
|
|
|
|
|
document.getElementById("slideContainer").innerHTML = str; |
|
|
} |
|
|
} |
|
|
catch (err) { |
|
|
catch (err) { |
|
|
//Failure
|
|
|
//Failure
|
|
|