Get an image through jQuery AJAX

后端 未结 2 576
逝去的感伤
逝去的感伤 2020-12-20 14:49

The following image tag is in my Login Page

\"Captcha\"
         


        
2条回答
  •  余生分开走
    2020-12-20 15:37

    web Server should return base64 Data. like this

    { base64Data:"blahblahblah" }
    

    your ajax request content-type could be plain json ; in your success function in ajax you could do like this

        success:function(data){
         var src="data:image/png;base64,"+data.base64Data;
          $('#CaptchaImg').attr(src,src)
    }
    

提交回复
热议问题