Wolfram API javascript cross origin sharing issue

耗尽温柔 提交于 2019-11-28 08:26:18

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/16268930/wolfram-api-javascript-cross-origin-sharing-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!