简体   繁体   中英

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.

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.

I'm bumping up against the Same Origin policy when trying to run that code in Chrome.

XMLHttpRequest cannot load. Origin null is not allowed by Access-Control-Allow-Origin.

The URL does return a valid JSON response however.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM