I have the following problem:
I have an image recorded in MySQL BLOB field
Fernando Skackauskas wrote:I am using AJAX because the image is recorded in a database Mysql. A Blob filed.
That makes no sense. That's like saying "I'm using a coffee cup to cut my food". Ajax is not suitable for image data.
Use the right tool for the job.
I already told you -- you change the src attribute.
The code you are using to retrieve the image data from the DB needs to be changed to return it as the response of a servlet (or whatever you are using), and with the correct content headers set. Then use the URL of that servlet (or whatever you are using) as the src of the image. (You may need to add a random request parameter to make the browser recognize that the src URL has changed if there are no other differences.)
Alternately, instead of using AJAX, you write a server-side function that returns image/png, image/jpeg, etc. and assign that function's URL to your <image> src attribute.