Server returns image only on POST request.
I should preload image.
How to put result to javascript object?
$.post('image.php', {params: complexParamsObject}, function(result) {
var image = new Image();
// put result to 'image' object
});
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you want a url return from post converted in an image tag then you can use this
if you want to return content of image you will have to return the content in base64 encoding. and using DataURLs you can create image element. this article shed some more light on it..
http://www.websiteoptimization.com/speed/tweak/inline-images/
EDIT:
a
yes base64 is a string representation.. Actually you will have to convert image in byte[] and then encode it to base64 string. and then return that string using post method…
where src=”data:image/gif;base64,(base64encoded image content here)
also have a look at this thread for base64 encoding and image creation.
Convert and insert Base64 data to Canvas in Javascript