0

キャプチャ用の画像を作成していますが、その画像を ajax 応答で取得するのに問題があります..ヘルプが必要です..私のコード:

ajax部分

$.ajax({
    type : "GET",
    url : "captcha.php",
    data : get_captcha_data,
    cache : false,
    success : function(r){
        $("#captcha").html('<img src="' + r + '" />');
    }


    });

php部分

session_start();
$code=rand(1000,9999);
$_SESSION["code"]=$code;
$im = imagecreatetruecolor(50, 24);
$bg = imagecolorallocate($im, 22, 86, 165);
$fg = imagecolorallocate($im, 255, 255, 255);
imagefill($im, 0, 0, $bg);
imagestring($im, 5, 5, 5,  $code, $fg);
header("Cache-Control: no-cache, must-revalidate");
header('Content-type: image/png');
print imagepng($im);

imagedestroy($im);

ここで何が問題になっているようですか?

4

1 に答える 1