I have a php script that randomly generates an image. Something like this:
Instead of $('#image').html(''), try $('#image').attr('src', data);
$('#image').html('')
$('#image').attr('src', data);