I'm attempting to retrieve the content of a CSS file from box.com using a direct link and add it to the head tag, but unfortunately, my current method is not successful.
$.ajax({
url: "https://app.box.com/shared/static/" + file_hash + ".css",
data: { client_id : '6guib1cgnk8uk2kdre45rjg7lt2xayegl94' },
type: "GET",
async: false,
crossDomain: true,
dataType: "text",
success: function (data) {
$("<style></style>").appendTo("head").html(data);
},
error: function (error) {
console.log(error);
}
}
);
Could someone offer guidance on how to resolve this issue?
Upon encountering an error, the response object looks like this:
Object
abort: function ( statusText ) {
always: function () {
complete: function () {
done: function () {
error: function () {
fail: function () {
getAllResponseHeaders: function () {
getResponseHeader: function ( key ) {
overrideMimeType: function ( type ) {
pipe: function ( /* fnDone, fnFail, fnProgress */ ) {
progress: function () {
promise: function ( obj ) {
readyState: 0
responseText: undefined
setRequestHeader: function ( name, value ) {
state: function () {
status: 0
statusCode: function ( map ) {
statusText: "error"
success: function () {
then: function ( /* fnDone, fnFail, fnProgress */ )