The entire process is asynchronous phpfunctionhideAvatar () {ob_clean (); $ filefile_get_contents (url); the url here is the real path of your image echo $ file;} htmlimgidimgimgjsLoadImage (img ); functionLoadImage (ElementID) {id requested image IDvarurlxxx
The entire process is asynchronous php function hideAvatar () {ob_clean (); $ file = file_get_contents (url); the url here is the real path of your image echo $ file ;} html img id = img/img js LoadImage (img); function LoadImage (ElementID) {// id requested image ID var url = http: // xxx
The entire process is asynchronous.
Php
Function hideAvatar (){
Ob_clean ();
$ File = file_get_contents (url); the url here is the actual path of your image
Echo $ file;
}
Html
Js
LoadImage ("img ");
Function LoadImage (ElementID)
{
// Id of the requested image ID
Var url = "http://xxx.xxx.xxx/hidehideAvatar? T = "+ Math. random ();/
Var xhrObject = new XMLHttpRequest ();
XhrObject. onreadystatechange = function event ()
{
If (xhrObject. readyState = 4)
{
If (xhrObject. status = 200)
{
Document. getElementById (ElementID). src = url;
Alert (url );
}
}
}
XhrObject. open ("get", url );
XhrObject. send (null );
}