Using html JSON script to store varibles

Hello. I have this basic html page setup:

<html>
<body>

<p>
Name: <span id="jname"></span>  

Age: <span id="jage"></span>  

</p>  

<script>
var JSONObject = { "name":"John Johnson", "age":23 };

document.getElementById("jname").innerHTML=JSONObject.name  
document.getElementById("jage").innerHTML=JSONObject.age  
</script>

</body>
</html>

I have uploaded it to my public dropbox, and it works like a normal website.
How would I go about modifying the ‘JSONObject’ variable via unity JavaScript, so like i can modify a varible in the unity script and the web page varibles will change (planning to do some kind of leader board)… If anyone can provide me a basic example or anything it would be greatly appreciated :slight_smile: :smiley:

If you’re using this from Windows Player, then you can use WWW, WWWForm or any other method available in .NET (e.g. HttpRequest) to send data to server. But please note that it has to be server, not a static HTML page like in your example.

You have to find some hosting service (there are plenty of them), and prepare your page so that it could accept client requests. You can use ASP.NET, ASP.NET MVC, PHP or any other server scripting language for this. Of course this language must be supported by the hosting provider.