Wolfram API javascript cross origin sharing issue
Asked Answered
I

1

6

How do I get wolfram's api requests to work? I just get cross-origin errors and a blank response: "XMLHttpRequest cannot load http://api.wolframalpha.com/v2/query?input=No&appid=xxx. Origin null(or another site) is not allowed by Access-Control-Allow-Origin."

Code is

var request = new XMLHttpRequest();
request.open("GET", "http://api.wolframalpha.com/v2/query?input=pi&appid=xxx", true);
request.onreadystatechange = function() {
    if(request.readyState == 4) {
        console.log("*"+request.responseText+"*");
    }
}

Thanks a bunch

Ipecac answered 28/4, 2013 at 22:57 Comment(0)
P
5

The Wolfram API does not allow requests from JavaScript. You will need to use a server-side library in order to query the API.

Paderna answered 29/4, 2013 at 1:55 Comment(1)
But javascript can be used server side with node.js.Teocalli

© 2022 - 2024 — McMap. All rights reserved.