Why getJSON method works only with local files? If I want to take json from local it works, but if I set url with http it doesnt work. why?
<!DOCTYPE html>
<html>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<script>
$.getJSON("http://www.address.com/getTables.php", function (data) {
$.each(data, function (i, table) {
$("#tables").append("<p>" + table.id + " " + table.tabname + "</p>");
});
});
</script>
<body>
<div id="tables"></div>
</body>
</html>
Returned JSON:
[{ "id":"12", "tabname":"cukry" }, { "id":"11", "tabname":"table" }]