I am trying to use WolframAlpha's API through Javascript. I don't understand why the following code returns me an empty alert. I'm new at jQuery, but I was told it was the best method to use right here.
<html>
<head>
<script src="jquery-2.1.1.min.js"></script>
</head>
<body>
<script>
$.get('http://api.wolframalpha.com/v2/query?appid=77P9PL-2QAWEY86WV&input=2x&format=image,plaintext', function(responseText) {
alert(responseText);
});
</script>
</body>
</html>
Thank you very much for your help
so this is suffering from a security mechanism called Cross Origin Scripting. The issue here is that the service you are calling from has not given permission for you to call that resource in an ajax call.
To read more look at http://en.wikipedia.org/wiki/Cross-origin_resource_sharing
To prove this is happening look at the JS Fiddle : http://jsfiddle.net/dgohczvf/1/
You can see in the console:
Another answer here suggested that you need to call this server to server: Wolfram API javascript cross origin sharing issue