I have a php script that randomly generates an image. Something like this:
I added another answer because I think that none of the previous answers solved the problem. I think, the only thing the OP wanted was to update(!) the image when the button is clicked. So there is no need for an Ajax request, just reload the image. And you can enforce that by appending a random query string to the image's src attribute.
$('#button').click(function() {
var $image = $('#image');
var plainSrc = $image.attr('src').split("?")[0]; // disregard previous query string
$image.attr('src', plainSrc + "?" + (new Date().getTime()));
});