I've a simple PHP script (create.php) which outputs a Captcha-Image using an existing PNG-Image:
<?php
session_start();
$myimg = ImageCreateFromPNG("foobar.png");
$captcha = rand(1000,9999);
$_SESSION["captcha"] = $captcha;
$font = "path/to/font";
$fontsize = 15;
$txtcolor = ImageColorAllocate($myimg, 0,0,0);
$angle = 0;
$coordx = 10;
$coordy = 20;
imagettftext($myimg,$fontsize,$angle,$coordx,$coordy,$color,$font,$captcha);
imagepng($myimg);
imagedestroy($myimg);
?>
I'm calling this script like this (output.php):
<div id="refresh">
<img src="create.php" alt="foo" />
</div>
<span id="trigger-refresh">reload</span>
<script>
$('#trigger-refresh').click(function() {
$('#refresh').load("refresh.php");
});
</script>
The file refresh.php just looks like this:
<?php
echo '<img src="create.php" alt="foo" />';
?>
When I call the refresh.php in browser, the Captcha-Image is shown correctly - everthing is fine. But after triggering the Jquery-Function in output.html the image/session does not reload. It's just working in Webkit-Browsers, e.g. Chrome. First I thought that the problem can be found in the browser-chache. So I cleared up cache - without any success. Firebug shows that "refresh.php" is load but not the "create.php".