So I’m attempting to work in an add-on to my calculator project. I would like to have a little text area where a user can enter a mathematical expression or generic question, and get the Wolfram Alpha Knowledge Engine short answer thrown up in the display.
Everything seemed to be going fairly smoothly. Grabbed an API ID and all the needed info for a JQuery AJAX request for the JSON data (I think…). However the request keeps failing and I get a few error messages in the web dev console:
Failed to load https://api.wolframalpha.com/v2/query?appid=ITSA-SECRETK&format=plaintext&output=json&input=have%20a%20question?: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://s.codepen.io' is therefore not allowed access. jquery.min.js:4
Cross-Origin Read Blocking (CORB) blocked cross-origin response https://api.wolframalpha.com/v2/query?appid=ITSA-SECRET&format=plaintext&output=json&input=have%20a%20question? with MIME type text/plain. See https://www.chromestatus.com/feature/5629709824032768 for more details.
I’ve tried using the XMLHttpRequest object for this task and seem to get about the same result. I don’t think I know enough about web requests yet to work this out myself. Is there a way around this issue?
I know there is a module they’ve made for nodeJS integration for API calls, but I was kind of hoping to keep this on codepen for now if possible.