Message from JavaScript discussions

June 2017

— Json : {"page": "hello world"}

— 

Can u tell me about this

var q = JSON.parse(this.responseText);
document.getElementById("page").innerHTML += q['page'];

?

— Wait, i will test it first

— Https://www.crayner.cf/test/test.html

— Https://www.crayner.cf/test/page1.json

— You can use innerHTML for change the HTML content

— JSON.parse()

— A common use of JSON is to exchange data to/from a web server.

— When receiving data from a web server, the data is always a string.

— Parse the data with JSON.parse(), and the data becomes a JavaScript object.

— Then, change the html element with content on JavaScript object.

— I see