My situation is that there is JSON data on a page I would like to work with, however I cannot seem to fetch the data. Either I get the error
Uncaught SyntaxError: Unexpected token : or XMLHttpRequest cannot load URL. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
The last one is if I remove the ?callback=?
from the URL I'm using. The URL I'm trying to fetch data from is this:
http://mxsimulator.com/servers/server.tmfactory-racing.com:19803/tracks/sx2016r01anaheim/records_450f
<!DOCTYPE html>
<html>
<head>
<title>JSON</title>
<meta charset="utf-8" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$.getJSON("http://mxsimulator.com/servers/server.tmfactory-racing.com:19803/tracks/sx2016r01anaheim/records_450f?callback=?",
function(data){
alert("Something");
});
});
</script>
</head>
<body>
<div id="datahere"></div>
</body>
</html>
All I want to do here essentially is to get the data into some form of object/variable I can work with and present in a way I could have use of it. I've tried a lot of ways I've found through googling, but I always end up with either of the 2 error messages mentioned above.
Any input in how I can get this to work is deeply appreciated.