简体   繁体   English

使用javascript / jquery将application / octet-stream; base64转换为json字符串或简单文本

[英]Convert application/octet-stream;base64, to json String or Simple Text using javascript/jquery

I am trying to get a json structure using ajax request and put json into a text box, but response return is of type application/octet-stream;base64, so it can't accept as simple text. 我正在尝试使用ajax请求获取json结构并将json放入文本框,但是响应返回类型为application / octet-stream; base64,因此它不能接受为简单文本。

function loaddata(){
var viewurl = "http://portalvhdskvdvlnrgl9scn.blob.core.windows.net/mbqrbxgghr/view_031ca05f-4e2e-49d6-ac6a-e05308340658.json";
$.ajax({
    url: viewurl,
    dataType: "json",
    success: function (data) {
        alert(data);
        $('#view').val(data);   
    }
});
}

I am getting response code 200. 我收到响应代码200。

I'm bumping up against the Same Origin policy when trying to run that code in Chrome. 尝试在Chrome中运行该代码时,我违反了同源起源策略。

XMLHttpRequest cannot load. XMLHttpRequest无法加载。 Origin null is not allowed by Access-Control-Allow-Origin. Access-Control-Allow-Origin不允许使用Origin null。

The URL does return a valid JSON response however. 该URL确实返回有效的JSON响应。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 NodeJS 将 base64 转换为八位字节流 - NodeJS convert base64 to octet-stream 如何将应用程序/八位字节流转换为要以 base64 或任何 jpeg 格式显示的图像? - How shall I convert application/octet-stream into image to be displayed in base64 or any jpeg format? 将base64中的图像发送到Webservice - 'application / octet-stream'不是预期的类型'text / xml; 字符集= UTF-8' - Sending image in base64 to Webservice - 'application/octet-stream' was not the expected type 'text/xml; charset=utf-8' 使用 firebase 的 putString() 上传 base64 png 会在存储中给我一个“类型:应用程序/八位字节流” - Uploading a base64 png with firebase's putString() gives me a 'type: application/octet-stream' in storage 将base64图像转换为javascript中的文件或如何使用jquery ajax传递大的base64字符串 - Convert base64 image to file in javascript or how to pass a big base64 string with jquery ajax 将八位字节流转换为图像 - Convert octet-stream to image 使用路径将PDF文件转换为Java中的Base64字符串 - convert PDF file using path to Base64 String in Javascript 如何使用JavaScript将一些base64字符串转换为pdf - How to convert some base64 string to pdf using javascript JSON.parse()用于类型为application / octet-stream的对象 - JSON.parse() for an Object of type application/octet-stream 将 base64 转换为 javascript/jquery 中的图像 - convert base64 to image in javascript/jquery
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM