Here is my code:
function init(){
$.get(URL, function(data) {
DATA = data;
var srcWithHead = URL + "/" + $(DATA).find("img").attr("src");
$(DATA).find("img").attr("src", srcWithHead);
console.log("src = " + $(DATA).find("img").attr("src"));
});
}
And I would like to have a picture showing. But the URL image src is a relative path. So, I need to have a header of each image. But it seems that
$(DATA).find("img").attr("src", srcWithHead);
doesn’t work.
What can I do? and any other method?
Thanks
You probably have multiple IMG tags. Use each() to access each one.