I have a php script that randomly generates an image. Something like this:
The src attribute of an image tag actually expects an URL not actual JPEG data.
src
Try this:
$(function(){ $('#button').click(function(){ $('#image').attr('src', 'models/plugins/image.php?rand=' + Math.floor(Math.random()*1000) ); }); });