Skip to content
This repository has been archived by the owner on Jul 30, 2022. It is now read-only.

Unable to get JSON query with jQuery #27

Open
ghost opened this issue Feb 7, 2014 · 12 comments
Open

Unable to get JSON query with jQuery #27

ghost opened this issue Feb 7, 2014 · 12 comments

Comments

@ghost
Copy link

ghost commented Feb 7, 2014

I am getting an error that says:
No 'Access-Control-Allow-Origin' header is present on the requested resource

I have been looking for the file I need to edit to make it so I can pull the Query data using jQuery, but I can't find it.

I am using this to populate a dashboard that is client friendly, and without this feature, I can't use the SuperProxy. Please let me know what file I need to update, or push an update allowing us to grab the file using jQuery!

@pfrisella
Copy link
Member

what does the request look like?
callbacks are supported, have you tried using that?

@ghost
Copy link
Author

ghost commented Feb 7, 2014

$.get('https://*****.appspot.com/query?id=ag5zfmNtc3VwZXJwcm94eXIVCxIIQXBpUXVlcnkYgICAgIDDlQoM', function(data) {....

I am requesting with jQuery through the $.get function. Should I be using $.getJSON, or something different? I am using jQuery so the data reloads every 2 minutes.

@ghost
Copy link
Author

ghost commented Feb 13, 2014

Any more information you can give? I would love to use SuperProxy, but if this is what is going to be happening, I can't use it.

@WillemPaling
Copy link

I had the same problem. I had to modify the python code to set the 'Access-Control-Allow-Origin' header.

@WillemPaling
Copy link

I've resolved the issue in my fork: https://github.com/WillemPaling/google-analytics-super-proxy

@Chris-Barber
Copy link

Hi, I have been having the same issue as RageQuit. WillemPaling I downloaded your fork but there is no config.py?

@WillemPaling
Copy link

Use the config.py from the main fork. I removed it because it had my login details in it :)
I'll fix it up...but that should get you going in the meantime.

@Chris-Barber
Copy link

I wondered if that was the case. Thanks for you quick response.

@Chris-Barber
Copy link

I have updated the config and re-deployed with app launcher. However, I am still getting the same issue.

405 (Method Not Allowed) No 'Access-Control-Allow-Origin' header is present on the requested resource.

Using:
$.ajax({
url: url,
cache: false,
success: function (data) {
handleData(data);
}
});

Any ideas how to overcome this?

@WillemPaling
Copy link

I had to change the version number in the app.yaml, and redeploy the app.
Then go into Google App Engine, go to Versions, then set the new version as the default.

@Chris-Barber
Copy link

Thanks! You are legendary! It worked like a charm.

@WillemPaling
Copy link

Good to hear it's working.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants