VincenzoCocciolo Posted October 11, 2021 Report Share Posted October 11, 2021 I'm trying to download one of the file stored in my Application and then place inline the content to a IMG elementi in my HTML page. This is the best I did. As a result the "data" contains a binary version of the image but the image in the html page is broken. Any helps is more than welcomed! $.ajax({ url : 'https://c2acw022.caspio.com/rest/v2/files/3512fabc-6f52-464b-ac9f-8bf0c3078773', type : 'GET', beforeSend: function (xhr) { xhr.setRequestHeader("Authorization", "Bearer " + accessToken); }, success: function (data, textStatus, jqXHR) { var base64data=btoa(unescape(encodeURIComponent(data))); $("#Logo").attr('src', 'data:image/png;base64,' + base64data); }, error: function (jqXHR, textStatus, errorThrown) { // do someghing else } }); Quote Link to comment Share on other sites More sharing options...
0 SidneyRees Posted April 13, 2022 Report Share Posted April 13, 2022 On 10/11/2021 at 1:47 PM, VincenzoCocciolo said: $.ajax({ url : 'https://c2acw022.caspio.com/rest/v2/files/3512fabc-6f52-464b-ac9f-8bf0c3078773', type : 'GET', beforeSend: function (xhr) { xhr.setRequestHeader("Authorization", "Bearer " + accessToken); }, success: function (data, textStatus, jqXHR) { var base64data=btoa(unescape(encodeURIComponent(data))); $("#Logo").attr('src', 'data:image/png;base64,' + base64data); }, error: function (jqXHR, textStatus, errorThrown) { // do someghing else } }); Were you ever able to make this work? Quote Link to comment Share on other sites More sharing options...
Question
VincenzoCocciolo
I'm trying to download one of the file stored in my Application and then place inline the content to a IMG elementi in my HTML page.
This is the best I did. As a result the "data" contains a binary version of the image but the image in the html page is broken.
Any helps is more than welcomed!
$.ajax({
url : 'https://c2acw022.caspio.com/rest/v2/files/3512fabc-6f52-464b-ac9f-8bf0c3078773',
type : 'GET',
beforeSend: function (xhr) {
xhr.setRequestHeader("Authorization", "Bearer " + accessToken);
},
success: function (data, textStatus, jqXHR) {
var base64data=btoa(unescape(encodeURIComponent(data)));
$("#Logo").attr('src', 'data:image/png;base64,' + base64data);
},
error: function (jqXHR, textStatus, errorThrown) {
// do someghing else
}
});
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.