获取图像src作为ajax响应

I need to set image src from ajax response,

I'm trying to get it from ajax but the response is coming like

��Y���.��L�-m1��s�%��vȪ��b<��a�����5�~$����흒6��G��H#;F9`p+��mޝ�"��t�n}FVɪ_�qd��1(��d���,���,p1q�H�D�՞�a����46V� �or9i��Y�X�OsV���{���s�K5��<����\�(��i��� etc..

this.

it's actually image/jpeg which is created by php file. anyone please help me to convert this to proper image source.

my ajax code is

$.ajax({
    method : "GET",
    url : "xxx/yyy/file.php?rand=rand()'; ?>",
    success : function(data)
    {
        $('#image_here').html('<img src="data:image/jpeg;base64,'+data+'">');
    }
});

thank you in advance.

I found the solution. I just want to do base64 encoding on image before sending it.

Thank you for all :)

you cant use this url : "xxx/yyy/file.php?rand=rand()'; ?>" coz' rand() will be same with prev value and it already faulty.

you can use Math.random();