- Home /
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 :) :D
Do you want to change this from Unity Web Player on the same page, or to update data on page from e.g. Windows Player?
Answer by ArkaneX · Sep 27, 2013 at 12:02 PM
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.
Your answer
Follow this Question
Related Questions
WebGL Redirect 0 Answers
HTML Text Input's Value? 1 Answer
Upload/store string to html/json script?? 0 Answers
Can't Access a Prefab 2 Answers