So I'm a complete newb and am trying to figure out how to use json correctly. Basically I'm asking why the first button in the code below will retrieve and display the json while the second and third will not. When visited in a browser all of the links are displayed in the same format as far as I can tell so I don't see where the problem is.
<html>
<head>
<script type="text/javascript" charset="utf-8" src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
<script>
function doJSON1() {
$.getJSON('http://time.jsontest.com/?alloworigin=true', function (data) {
alert(JSON.stringify(data))
});
}
function doJSON2() {
$.getJSON('http://api.vircurex.com/api/get_info_for_1_currency.json?base=DOGE&alt=BTC', function (data) {
alert(JSON.stringify(data))
});
}
function doJSON3() {
$.getJSON('http://pubapi.cryptsy.com/api.php?method=singleorderdata&marketid=132', function (data) {
alert(JSON.stringify(data))
});
}
</script>
</head>
<body>
<h3>Get JSON1</h3>
<button onclick="doJSON1()">Get JSON</button>
<h3>Get JSON2</h3>
<button onclick="doJSON2()">Get JSON</button>
<h3>Get JSON3</h3>
<button onclick="doJSON3()">Get JSON</button>
</body>
</html>