I'm trying to replace an image on button click but I don't seem to figure it out. I get an image from my server that looks like this photo/1583testImg.png from my ajax value. I wan't now to replace the current photo with the one that i get from the server through ajax.
for(file in search){
var title = search[file].title;
var photo = search[file].path;
$(".search-result:first").clone().appendTo(".search").find("h3").text(title);
$(".search-result:first").clone().appendTo(".search").find("src").replace(photo); // this is the codeline that doesn't work
console.log(title+"+"+photo);
}