I have a PHP script that generates an image with PHP GD. After it generates the image, it saves it, and send this output when called by Ajax:
imagejpeg($img_data
base64 encode the image and return that, then you can do an
On the PHP side
$image = base64_encode($imageGDRender);
echo json_encode(array('image'=>$image));
That will return your json back to your jquery
then on the ajax side
$.ajax({
...
success: function(data) {
var base64Image = data.image;
...now put it in your image
$('#image').attr('src','data:image...'+base64Image);
})....