I am trying to design a module in which I would like to show a preview of the image to the user before he uploads the image to database.
I have found a solution which wo
Use jQuery ajax to solve your problem.
$.ajax({
type: "post",
url: "serverURL?randomParam="+(Math.random() * 1000),
cache: false,
data: null,
success: function(json){
try{
var obj = JSON.parse(json);
if(obj[0].IMAGE!=null){
$("#captchaImage").attr("src", obj[0].IMAGE);
}
}catch(e) {
showMessage("E1");
}
},
error: function(){
}
});