I have looked through similar questions on here and none of the responses seemed to help as they aren't using vanilla JS. Hopefully someone here can help out. Note: also using IMDB API if that makes a difference. Really new to APIs and hoping this is just some stupid error on my part.
var searchButton = document.getElementById("searchBtn");
var navContainer = document.getElementById("navContainer");
var userInput = document.getElementById("charSearch");
var savedSearches = JSON.parse(localStorage.getItem("hero")) || [];
var currentSearch = savedSearches.length;
var imdbApiStart = "https://imdb-api.com/en/API/Search/"
var imdbKey = "k_zcmn64r8/";
var marvelApiStart =
"https://gateway.marvel.com:443/v1/public/characters?apikey=";
var marvelKey = "public_key";
var marvelOtherKey = "my_private_key";
var ts = new Date().getTime();
var hash = ts +marvelKey+marvelOtherKey;
var passhash = CryptoJS.MD5(hash).toString();
console.log(passhash);
function getHeroInfo() {
getMovieInfo(userInput.value);
var requestUrl = marvelApiStart + marvelKey + "&hash=" + hash + "&name=" + userInput.value
console.log(requestUrl);
var result = fetch(requestUrl)
.then(function (response) {
return response.json();
})
.then(function (data) {
console.log(data);
});
return result;
}
function postHeroInfo(data) {
}
searchButton.addEventListener("click", getHeroInfo);