Picture this scenario: I send an ajax request to my PHP server with the name of an image file, and the server is restricted from sending a direct link to the file. Instead, it must send the file contents using PHP's readfile(); function. Now, when this data is returned, how can JavaScript set the src attribute of an img element?
myXMLHttpRequest.onload=function(){
imgElement.src= /*need help working with myXMLHttpResponse.reponseText*/;
}
The goal here is to populate the src attribute using binary content of an image file stored in a string.