I'm trying to connect to an API. By doing this with a static string, it works fine, but when I'm doing it by using a variable, it seems not to work.
This is how my code looks:
var movie = 'taken';
OurRequest.open('GET', 'http://www.omdbapi.com/?s=${movie}&apikey=222222');
OurRequest.onload = function() {
console.log(OurRequest.responseText);
};
OurRequest.send();
So when I remove ${movie}
and replace it with 'taken'
as a string, it works fine.