我试图获取通过AJAX,已经使用InkFilePicker上传存储在S3中的图像。 InkFilePicker有一个方法叫做filepicker.read(),它可用于从图像读取的原始数据。然而,这是相当有限的,所以我想用jQuery.ajax()来代替。但似乎他们不返回完全相同的数据。
I'm trying to fetch an image stored at S3, via AJAX, which has been uploaded using InkFilePicker. InkFilePicker has a method called filepicker.read() which can be used to read the raw data from an image. However, it's quite limited so I want to use jQuery.ajax() instead. But it seems that they don't return exactly the same data.
中的数据时,它记录到控制台时使用filepicker.read()看起来是这样的:
The data received when using filepicker.read() looks like this when logging it to the console:
在使用jQuery.ajax(),它看起来是这样的:
When using jQuery.ajax() it looks like this:
在使用由jQuery.ajax()我的其他脚本似乎打破(我提取EXIF数据),返回的数据。
When using the data returned by jQuery.ajax() my other scripts seems to break (I'm extracting the EXIF data).
那么,为什么它显得与众不同呢?请问jQuery的尝试连接Ç不知何故数据code /德$ C $?我能prevent呢?
So, why does it look different at all? Does jQuery try to encode/decode the data somehow? Can I prevent that?
好吧,我不得不将它添加到覆盖MIMETYPE 出于某种原因...
Ok, I had to add this to override the mimetype for some reason...
$.ajax({
...
beforeSend: function(xhr) {
xhr.overrideMimeType( "text/plain; charset=x-user-defined" )
}
...
})