My json file looks like this:
{
"data": {
"test":"0123"
}
}
And I get this error: Uncaught SyntaxError: Unexpected token ':'
Why does this happen and how can I fix the problem?
Edit: the HTML code
<html>
<body>
<button id="clickThis" onclick="change()">
Text here
</button>
<script type="text/javascript" src="./lista.json">
function change() {
var mydata = JSON.parse(data)
document.getElementById("clickThis").innerHTML = "this"
}
</script>
</body>
</html>
<html>
<body>
<button id="clickThis">
Text here
</button>
<script src="./lista.json">
</script>
</body>
</html>