Here is what I'm trying to figure out. How to write $.get(url,function(data) { code }; in pure JavaScript.
function newimage(keyword){
if(!ACCESS_KEY){
alert("Please update your access key");
return;
}
var url = `https://api.unsplash.com/search/photos?query=${keyword}&per_page=20&orientation=landscape&client_id=${ACCESS_KEY}`;
$.get(url,function(data){
var picture = data.results[0];
var picture_url = picture.urls.raw;
var photo_by_name = picture.user.name;
var photo_by_url = picture.user.links.html;
setCookie("picture",picture_url,0.5);
setCookie("photo-by-name",photo_by_name,0.5);
setCookie("photo-by-url",photo_by_url,0.5);
picInterest.innterHTML = `${keyword}`;
photoBy.innterHTML = `${photoByUrl}`;
photoBy.setAttribute('html', photoByUrl);
document.querySelector("body").style.backgroundImage = `url(${pictureUrl})`;
pictureOption.style.display = "block";
});
}