In the head of the page where the javascript will be
<script src="local/do//jQuery.js"></script>
In the context of HTML / 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 asks for 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 Profileecontroller.php, is where I did the test here at home, but to work for you, Check in your project, which is the way to access the image.
Generic PHP example / 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();
worse than not, I saw by the console that the way is still that of the old image
– Reignomo
When you get the image by the direct url in the Browser it is loaded correctly?
– Eleison Christiano
Try placing another value, and check by the browser’s Inspect on the page if this new value is assigned.
– Eleison Christiano
yes I can catch the image by the browser
– Reignomo
changed the value in javascript did not work, even removing from php
– Reignomo