From f43406a9e0ef21e12a1f240a7ae64ebe364f6064 Mon Sep 17 00:00:00 2001 From: rosh Date: Wed, 5 Aug 2020 12:04:31 +0530 Subject: [PATCH] search as list --- movies.js | 22 +++++++++++++++------- searchmovies.html | 1 + 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/movies.js b/movies.js index 0f89c54..f253f74 100644 --- a/movies.js +++ b/movies.js @@ -34,7 +34,6 @@ async function submitForm(e){ } } -var token; async function submitForm1(e){ e.preventDefault(); @@ -51,7 +50,7 @@ async function submitForm1(e){ const data1 = await response.json(); //Success code goes here alert(JSON.stringify(data1)); - token = data1.token; + window.localStorage.setItem('Token', (data1.token)); window.location = "searchmovies.html"; } catch (err) { @@ -62,17 +61,26 @@ async function submitForm1(e){ async function search(e){ e.preventDefault(); - + var Token=window.localStorage.getItem('Token'); try { const response = await fetch('https://mkr.thefeathers.in/search/'+searchkey, { method: 'GET', - headers: new Headers({'content-type': 'application/json'}), - headers: new Headers({ 'Authentication': token }) + headers: new Headers({'content-type': 'application/json', 'Authentication': Token }), }); - const data = await response.json(); + const data2 = await response.json(); //Success code goes here //window.location = "searchmovies.html"; - alert(JSON.stringify(data)); + alert(JSON.stringify(data2)); + var str = ''; + document.getElementById("slideContainer").innerHTML = str; } catch (err) { //Failure diff --git a/searchmovies.html b/searchmovies.html index afeae9a..a430e9d 100644 --- a/searchmovies.html +++ b/searchmovies.html @@ -15,6 +15,7 @@ +
\ No newline at end of file