Skip to content Skip to sidebar Skip to footer

How Do I Resolve A 'mime Type Mismatch Error' Blocking An Ajax-requested Resource From My Google Apps Script?

I am trying to implement the code here with Jquery.ajax rather than fetch. I get the following error when I make the AJAX call: The resource from “https://script.googleuserconte

Solution 1:

I believe your goal as follows.

  • You want to request to the Web Apps using jQuery.ajax() instead of fetch.

For this, when your settings is modified, how about the following modification?

Modified script:

var settings = {
  'url': url,
  'method': 'GET',
  'dataType':"json",
  'data': {spreadsheetId: "###SpreadsheetId###", sheetName: "###SheetName###"},
};
Sample script:
var url = 'https://script.google.com/macros/s/###/exec';
var settings = {
  'url': url,
  'method': 'GET',
  'dataType':"json",
  'data': {spreadsheetId: "###SpreadsheetId###", sheetName: "###SheetName###"},
};
$.ajax(settings).done(res => {
  console.log(res.values);  // By this, you can retrieve the values of `{values: values}` from Web Apps.
}).fail(err =>console.log(err));

Note:

  • When you modified the Google Apps Script of Web Apps, please redeploy the Web Apps as new version. By this, the latest script is reflected to the Web Apps. Please be careful this.
  • In above modified script, your Google Apps Script could be used.
  • In this case, I could confirm that the above script worked with Chrome.

Reference:

Post a Comment for "How Do I Resolve A 'mime Type Mismatch Error' Blocking An Ajax-requested Resource From My Google Apps Script?"