In the head of the page where the javascript will be
<script src="local/do//jQuery.js"></script>
In the HTML context / Who shows the image
<img id="imagemPerfil"
alt="profile image"
class="circle z-depth-2 responsive-img activator gradient-45deg-light-blue-cyan gradient-shadow">
In the context of Javascript / Who requests the image
<script>
$(document).ready(function () {
var params = {
Request: "GetImgPerf"
};
$.get("PerfilUsuarioController.php", params, function (respImg) {
$("#imagemPerfil").attr("src", respImg);
});
});
</script>
In the part where you enter the ProfileUserController.php, it is where I did the test here at home, but to work for you, check in your project, what is the path to access the image.
Generic example PHP / Who provides the image
class PerfilUsuarioController {
public function verificarRequest() {
$request = $_GET["Request"];
switch ($request) {
case "GetImgPerf":
$this->getImgPerfil();
break;
default:
break;
}
}
public function getImgPerfil() {
// Codigo de busca do usua ou qualquer outra verificação
print $usuario_pesquisado->getImg();
}
}
$perf = new PerfilUsuarioController();
$perf->verificarRequest();