Render Json file in Webbrowser
Hello
I have the following html code and Javascript code.
It's a page when I press on a button a function ' loadDatos' will be called
And it opens my local json file (on my harddisk). The json file is converted from a obj file that was a cube made in blender
If I show it I see the code in a alertbox
But I would like to see the cube in my webbrowser.
Which function do I need ?
Code:
<!DOCTYPE html>
<html>
<head>
<script>
function loadDatos() {
var xobj = new XMLHttpRequest();
xobj.overrideMimeType("application/json");
xobj.open('GET', 'part1.json', true);
xobj.onreadystatechange = function ()
{
if (xobj.readyState == 4)
{
alert('test');
var jsonTexto = xobj.responseText;
alert(jsonTexto);
//ProcessTheData(jsonTexto);
}
}
xobj.send(null);
}
</script>
</head>
<body>
<body>
<h1>My First JavaScript</h1>
<p id="demo">This is a paragraph.</p>
<button type="button" onclick="loadDatos()">Display Date</button>
</body>
</body>
</html>
Thanks!