0

I am sending an (HTTP GET) $.ajax request (from jsfiddle) to my Google Apps Script server and I get the following error:

XMLHttpRequest cannot load https://script.google.com/macros/s/mykey?params.

Origin http://fiddle.jshell.net is not allowed by Access-Control-Allow-Origin.

What is the best way to solve this problem?

I have successfully implemented jsonp $.ajax requests to retrieve json data and javascript using this GAS/jsfiddle configuration. However, I seem unable to accomplish this jsonp success this time. Possibly because I am going through an .updaterow() function (per jqWidgets?)

My research:

  1. This post almost asks a similar question except it is not specific to GAS.
  2. I do not think GAS allows one to set server-side response headers. But surely there must be a way to get my request to execute?
  3. Perhaps this question explains it better? (GAS issue) Is there a workaround solution? (Come on creative people.)
Community
  • 1
  • 1
Let Me Tink About It
  • 15,156
  • 21
  • 98
  • 207
  • if you can't set the server-side response headers, then it isn't possible to get said data other than with jsonp or a proxy. – Kevin B Sep 05 '13 at 20:28
  • When I try jsonp, I get an error that just says, Status: cancelled. and Type: pending. I have no idea what that means or why I get it. (Per chrome developer tools.) – Let Me Tink About It Sep 05 '13 at 21:24
  • I have no idea either. I haven't encountered that. – Kevin B Sep 05 '13 at 21:27
  • http://stackoverflow.com/questions/11481222/how-do-i-make-xhr-ajax-requests-against-google-apps-script-contentservice-work <-- This question perhaps explains it better? (See item#3 in last paragraph of question if you can not view the link. I edited the original question to include that link.) – Let Me Tink About It Sep 05 '13 at 21:54

1 Answers1

2

GAS does not allow CORS headers at this time.

Let Me Tink About It
  • 15,156
  • 21
  • 98
  • 207