Hello,
I am not sure if this is the right place - I can't seem to find anywhere to submit a support question (even under the "Questions" section). Sorry if this is the wrong spot!
I am using D3.js, a data visualization library, to create a map. On my nationbuilder site, it loads data asynchronously through AJAX. My site is funderstogether.org.
I am having trouble configuring nationbuilder to load these resources without triggering access errors. In preview mode, which loads resources through funderstogether.nationbuilder.org, the script works. However, in published mode (which uses funderstogether.org/myD3script, for example), the script breaks, citing an issue with Access-Control-Allow-Origin. This surprise seems to defeat the purpose of a preview mode. How can I configure nationbuilder to load these resources from funderstogether.org/*.js instead of funderstogether.nationbuilder.com?
Here is the console error:
"XMLHttpRequest cannot load http://funderstogether.nationbuilder.com/themes/1/52cd4c2801925b740b000002/0/attachments/13896789921390712899/default/states.js. The 'Access-Control-Allow-Origin' header contains the invalid value '*.funderstogether.org'. Origin 'http://www.funderstogether.org' is therefore not allowed access."
Thank you for any help you're able to provide!
Please see below for suggestions!
Showing 4 reactions
Sign in with
Would you mind taking a shot at changing the domain of states.js to your custom domain:
http://www.funderstogether.org/themes/1/52cd4c2801925b740b000002/0/attachments/13896789921390712899/default/states.js
This link should redirect to the funderstogether.nationbuilder.com asset and grab it.
Another option would be to try jsonp instead of json, if you aren’t using PUT, POST, or DELETE.
Let me know if this helps, or if you’d like me to take a look at the page where you’re making the AJAX call.